public CreatePresetResponse createPreset ( CreatePresetRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getName ( ) , "The parameter name should NOT be null or empty string." ) ; if ( request . getAudio ( ) != null ) { checkNotNull ( request . getAudio ( ) . getBitRateInBps ( ) , "The parameter bitRateInBps in audio should NOT be null." ) ; checkIsTrue ( request . getAudio ( ) . getBitRateInBps ( ) > 0 , "The audio's parameter bitRateInBps should be greater than zero." ) ; } if ( request . getVideo ( ) != null ) { checkNotNull ( request . getVideo ( ) . getBitRateInBps ( ) , "The parameter bitRateInBps in video should NOT be null." ) ; checkIsTrue ( request . getVideo ( ) . getBitRateInBps ( ) > 0 , "The video's parameter bitRateInBps should be greater than zero." ) ; checkNotNull ( request . getVideo ( ) . getMaxFrameRate ( ) , "The parameter maxFrameRate in video should NOT be null." ) ; checkIsTrue ( request . getVideo ( ) . getMaxFrameRate ( ) > 0 , "The video's parameter maxFrameRate should be greater than zero." ) ; checkNotNull ( request . getVideo ( ) . getMaxWidthInPixel ( ) , "The parameter maxWidthInPixel in video should NOT be null." ) ; checkIsTrue ( request . getVideo ( ) . getMaxWidthInPixel ( ) > 0 , "The video's parameter maxWidthInPixel should be greater than zero." ) ; checkNotNull ( request . getVideo ( ) . getMaxHeightInPixel ( ) , "The parameter maxHeightInPixel in video should NOT be null." ) ; checkIsTrue ( request . getVideo ( ) . getMaxHeightInPixel ( ) > 0 , "The video's parameter maxHeightInPixel should be greater than zero." ) ; } // not support yet request . setThumbnail ( null ) ; request . setWatermarks ( null ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . POST , request , LIVE_PRESET ) ; return invokeHttpClient ( internalRequest , CreatePresetResponse . class ) ; }
Create a live preset which contains parameters needed in the live stream service .