src/BaiduBce/Services/Lss/LssClient.php
public function createPreset($name, $options = array())
    {
        list($config, $description, $forwardOnly, $audio, $video, $hls, $rtmp) = $this->parseOptions(
            $options,
            'config',
            'description',
            'forwardOnly',
            'audio',
            'video',
            'hls',
            'rtmp'
        );

        if (empty($name)) {
            throw new BceClientException("The parameter name "
                . "should NOT be null or empty string");
        }

        $body = array(
            'name' => $name,
        );

        if ($description !== null) {
            $body['description'] = $description;
        }
        if ($forwardOnly !== null) {
            $body['forwardOnly'] = $forwardOnly;
        }
        if ($audio !== null) {
            $body['audio'] = $audio;
        }
        if ($video !== null) {
            $body['video'] = $video;
        }
        if ($hls !== null) {
            $body['hls'] = $hls;
        }
        if ($rtmp !== null) {
            $body['rtmp'] = $rtmp;
        }

        return $this->sendRequest(
            HttpMethod::POST,
            array(
                'config' => $config,
                'body' => json_encode($body),
            ),
            '/preset'
        );
    }
public function createPreset($name, $options = array())
    {
        list($config, $description, $forwardOnly, $audio, $video, $hls, $rtmp) = $this->parseOptions(
            $options,
            'config',
            'description',
            'forwardOnly',
            'audio',
            'video',
            'hls',
            'rtmp'
        );

        if (empty($name)) {
            throw new BceClientException("The parameter name "
                . "should NOT be null or empty string");
        }

        $body = array(
            'name' => $name,
        );

        if ($description !== null) {
            $body['description'] = $description;
        }
        if ($forwardOnly !== null) {
            $body['forwardOnly'] = $forwardOnly;
        }
        if ($audio !== null) {
            $body['audio'] = $audio;
        }
        if ($video !== null) {
            $body['video'] = $video;
        }
        if ($hls !== null) {
            $body['hls'] = $hls;
        }
        if ($rtmp !== null) {
            $body['rtmp'] = $rtmp;
        }

        return $this->sendRequest(
            HttpMethod::POST,
            array(
                'config' => $config,
                'body' => json_encode($body),
            ),
            '/preset'
        );
    }
public function createPreset ( $ name , $ options = array ( ) ) { list ( $ config , $ description , $ forwardOnly , $ audio , $ video , $ hls , $ rtmp ) = $ this -> parseOptions ( $ options , 'config' , 'description' , 'forwardOnly' , 'audio' , 'video' , 'hls' , 'rtmp' ) ; if ( empty ( $ name ) ) { throw new BceClientException ( "The parameter name " . "should NOT be null or empty string" ) ; } $ body = array ( 'name' => $ name , ) ; if ( $ description !== null ) { $ body [ 'description' ] = $ description ; } if ( $ forwardOnly !== null ) { $ body [ 'forwardOnly' ] = $ forwardOnly ; } if ( $ audio !== null ) { $ body [ 'audio' ] = $ audio ; } if ( $ video !== null ) { $ body [ 'video' ] = $ video ; } if ( $ hls !== null ) { $ body [ 'hls' ] = $ hls ; } if ( $ rtmp !== null ) { $ body [ 'rtmp' ] = $ rtmp ; } return $ this -> sendRequest ( HttpMethod :: POST , array ( 'config' => $ config , 'body' => json_encode ( $ body ) , ) , '/preset' ) ; }
Create a preset.

@param $name string, preset name
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
description: string, preset description
forwardOnly: boolean, whether the preset is forward-only.
when forwardOnly = true, should not set audio/video.
audio: { audio output settings
bitRateInBps: number, output audio bit rate
sampleRateInHz: number, output audio sample rate
channels: number, output audio
},
video: { video output settings
codec: string, output video codec, valid values: h264
codecOptions: {
profile: string, valid values: baseline/main/high
}
bitRateInBps: number, output video bit rate
maxFrameRate: number, output video max frame rate
maxWidthInPixel: number, output video max width
maxHeightInPixel: number, output video max height
sizingPolicy: string, output video sizing policy,
valid values: keep/stretch/shrinkToFit
},
hls: { hls output settings
segmentTimeInSecond: number, each hls segment time length
segmentListSize: number, length of segment list in the output m3u8
adaptive: boolean, whether adaptive hls is enabled
},
rmtp: { rmtp output settings
gopCache: boolean, whether or not cache 1 gop
}
}
@return mixed
@throws BceClientException
Create a preset .