Initializing Flash player with set Bitrate
Legacy (for Flash video player only)
By default Flash player selects the highest quality encoded video stream to initialize playback. Flash player is also not adaptive.
Many users wish to make available a high-resolution and high-bitrate video stream for their users, but want as default a lower resolution stream. Users can then can pass the forcedBitrate parameter. On entering the value, the available bitrate closest to the entered value is selected. Setting forcedBitrate would initialize playback at that bitrate. For example for video files encoded at 300
, 700
, 1000
and 1600
kbps, entering "forcedBitrate": 900
would initialize video stream at 1000kbps, which is the closest available bitrate.
Adaptive playback in HTML5 player by default initializes with the lowest bitrate stream, and then immediately switches to the highest quality video stream for the given network bandwidth. Users can manually switch their preferred stream in both Flash and HTML5 player.
{ "forcedBitrate": 900}
#
Get OTP Sample CodeThe sample videoID is 1234567890
and the API Secret Key is a1b2c3d4e5
. This sample code below only passes the forcedBitrate as parameter.
- CURL
- NODE
- PHP
- C#
- Python
- Ruby
curl -X POST \ https://dev.vdocipher.com/api/videos/1234567890/otp \ -H 'Accept: application/json' \ -H 'Authorization: Apisecret a1b2c3d4e5' \ -H 'Content-Type: application/json' \ -d '{ "forcedBitrate":300}'
var request = require("request");
var options = { method: "POST", url: "https://dev.vdocipher.com/api/videos/1234567890/otp", headers: { Accept: "application/json", "Content-Type": "application/json", Authorization: "Apisecret a1b2c3d4e5", }, body: { forcedBitrate: 300 }, json: true,};
request(options, function (error, response, body) { if (error) throw new Error(error);
console.log(body);});
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => "https://dev.vdocipher.com/api/videos/1234567890/otp", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => json_encode([ "forcedBitrate" => 300 ]), CURLOPT_HTTPHEADER => array( "Accept: application/json", "Authorization: Apisecret a1b2c3d4e5", "Content-Type: application/json", ),));
$response = curl_exec($curl);$err = curl_error($curl);
curl_close($curl);
if ($err) { echo "cURL Error #:" . $err;} else { echo $response;}
var client = new RestClient("https://dev.vdocipher.com/api/videos/1234567890/otp");var request = new RestRequest(Method.POST);request.AddHeader("Accept", "application/json");request.AddHeader("Content-Type", "application/json");request.AddHeader("Authorization", "Apisecret a1b2c3d4e5");request.AddParameter("undefined", "{\n\t\"forcedBitrate\":300\n}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);
import requestsimport json
url = "https://dev.vdocipher.com/api/videos/1234567890/otp"
payload = json.dumps{{"forcedBitrate":300}}headers = { 'Authorization': "Apisecret a1b2c3d4e5", 'Content-Type': "application/json", 'Accept': "application/json" }
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
require 'uri'require 'json'require 'net/http'
url = URI("https://dev.vdocipher.com/api/videos/1234567890/otp")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)request["Authorization"] = 'Apisecret a1b2c3d4e5'request["Content-Type"] = 'application/json'request["Accept"] = 'application/json'request.body = ({:forcedBitrate => 300}).to_json
response = http.request(request)puts response.read_body