This is a message.

Deliver Live Adaptive Bitrate Video with Adobe HTTP Streaming

This Bandwidth detection plugin does the same as the standard bandwidth detection plugin but for Adobe HTTP Streaming only. It monitors the bandwidth that is available and selects the stream that is suited best.

The player shown above uses dynamic stream switching with Adobe's HTTP Streaming.

For all other delivery methods choose the standard Bandwidth detection plugin.

Features

  • Bandwidth detection at startup, quality Of Service monitoring and dynamic stream switching.

More Information:

Flowplayer configuration

Here is the configuration used in the example. It uses the dynamic property to enable dynamic stream switching.

flowplayer('httpstreaming-dynamic', 'http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf', {
clip: {
// the manifest file
url: 'sample1.f4m',
 
// we need 2 urlResolvers
urlResolvers: ['f4m','bwcheck'],
 
// use the httpstreaming plugin
provider: 'httpstreaming',
 
// directory where the manifest and video fragments are stored
baseUrl: 'http://stream.flowplayer.org/httpstreaming/',
 
autoPlay: false
},
plugins: {
f4m: {
url: 'flowplayer.f4m-3.2.10.swf'
},
httpstreaming: {
url: 'flowplayer.httpstreaming-3.2.11.swf'
},
controls: {
// the 'tube' skin
url: 'flowplayer.controls-tube-3.2.16.swf'
},
 
bwcheck: {
url: 'flowplayer.bwcheck_httpstreaming-3.2.13.swf',
dynamic: true,
// show the selected file in the content box
// usually omitted in production
onStreamSwitchBegin: function (newItem, currentItem) {
var content = $f('httpstreaming-dynamic').getPlugin('content');
var message = 'Will switch to: ' +
newItem.streamName +
' from ' +
currentItem.streamName;
content.setHtml(message);
},
onStreamSwitch: function (newItem) {
var content = $f('httpstreaming-dynamic').getPlugin('content');
var message = 'Switched to: ' + newItem.streamName;
content.setHtml(message);
}
},
 
// a content box to display the selected bitrate
// usually omitted in production
content: {
url: 'flowplayer.content-3.2.9.swf',
bottom: 30,
left: 0,
width: 400,
height: 150,
backgroundColor: 'transparent',
backgroundGradient: 'none',
border: 0,
textDecoration: 'outline',
style: {
body: {
fontSize: 14,
fontFamily: 'Arial',
textAlign: 'center',
color: '#ffffff'
}
}
}
}
});

JavaScript

Note how the master F4M manifest sample1.f4m provides the required bitrate metadata. We therefore do not configure an array of bitrates like for other delivery methods. The contents of sample1.f4m could roughly be translated to the following JSON configuration:

bitrates: [
{url: 'sample1_150kbps', bitrate: 150},
{url: 'sample1_500kbps', bitrate: 500},
{url: 'sample1_700kbps', bitrate: 700},
{url: 'sample1_1000kbps', bitrate: 1000},
{url: 'sample1_1500kbps', bitrate: 1500}
]

JavaScript

See this demo as a standalone version.

Alternative plugin

Plugin properties

PropertyDefaultDescription

bitrateProfileName

bitrateProfile

Used when detected bandwidth values are remembered (see the rememberBitrate setting). This is the name of the Shared Object where the bitrates are saved. You might want to change this if you have different sets of files and you want to keep the detected bandwidths separate for those sets.

cacheExpiry

86400

Used when detected bandwidth values are remembered (see the rememberBitrate setting). The expiration time for cached bitrates. The default value is 24 hours (86400 seconds). After the expiration period has passed, the bandwidth is re-detected.

dynamic

false

Enables dynamic stream switching (Quality Of Service monitoring) for Adobe Flash Media Server 3 and Wowza Media Server 2.

dynamicBuffer

false

When enabled, this feature will dynamically calculate the best buffer time to suit the available bandwidth.

maxWidth

null

Sets the maximum video width that will be selected. By default the maximum width is the width of the video screen area. This value can be used to override this. Sometimes used when the player is resized dynamically using scripting to follow the selected stream dimensions.

netConnectionUrl

null

The URL used to check the bandwidth. It should point to a reference file that is loaded as part of the check. The file should reside on the same host as the plugin, or it will require domain context policies for remote loading of the file to prevent sandbox issues.

qos

{frames: false, screen: true, bufferScaleDownFactor: 0.6}

Specifies the dynamic switching rules to be used. Used when dynamic is set to true. The following rules are available:

  • frames - switches up or down based on the number of dropped video frames. Not used by default.
  • screen - switches up or down based on the width of the video screen. If you remove the screen rule the plugin selects the stream without considering the screen size. This causes a video wider than the screen to be selected if the other rules allow this.
  • bufferScaleDownFactor - by which factor of the current bitrate the choice of a lower bitrate should be determined. Higher factors are safer, but make for less smooth transitions.

rememberBitrate

false

Indicates whether the detected bandwidth should be remembered for the client browser. If true the detection is performed only once per domain and stored on the client browser. If false the detection is done every time a clip starts playing.

serverType

http

Identifies the type of server that we will be checking against. Available values are 'http', 'red5', 'wowza', and 'fms'.

switchOnFullscreen

true

Used when dynamic is set to false. Causes a bandwidth check and a switch when entering fullscreen or exiting fullscreen. When dynamic is set to true the plugin is doing QoS monitoring and switching dynamically if needed, also taking care the screen resize that happens with fullscreen mode.

JavaScript API

Methods

MethodReturnsDescription

getBitrate()

int

Gets the current bitrate. The returned value is the bitrate in use after the latest bitrate transition has been completed. If a bitrate switch is in progress the value reflects the bitrate right now being used, not the one we are switching to.

setBitrate(bitrate)

null

Changes the stream to the specified bitrate. The specified value should be one of the values contained in the bitrates array. If the player is currently playing a clip, the stream corresponding to the specified bitrate is started. If dynamic stream switching is enabled, the stream switches dynamically while playing; otherwise, the stream plays from the start of the clip. Note: QoS monitoring and dynamic stream switching is disabled when this method is called so that the dynamic switching does not override the bitrate specified using this method. You can enable dynamic switching again using the enableDynamic() method (see below).

enableDynamic(enabled)

null

Enables or disables dynamic stream switching. The specified enabled value is a Boolean specifying the enabled state.

checkBandwidth()

null

Initiates a new bandwidth check. The detected bandwidth is stored in the client browser if the config option rememberBitrate is set to true. If the player is currently playing a clip, a new stream based on the detected bandwidth is selected and started. If dynamic stream switching is enabled, the stream switches dynamically while playing; otherwise, the stream plays from the start of the clip. When the bandwidth check is successfully called, the onBwDone event is called allowing you to get the results.

Events

EventWhen does it fire?

onBwDone()

Fires when the bandwidth has been detected. The callback is fed with the following 2 arguments:

  • item - the chosen bitrate item: object with members like item.bitrate, item.url, item.width etc.
  • bitrate - the detected bitrate

onStreamSwitchBegin(newItem, currentItem)

Fires when a bitrate switch is initiated. A second event is fired when the switch is completed, see below. This event is called only when the dynamic configuration property is enabled. The callback is fed with two bitrateItem objects that describe the new bitrate we are switching to and the current one. These objects have the following properties:

  • streamName - the name of the stream
  • bitrate
  • width

onStreamSwitch(newItem)

Fires when the bitrate switch has been completed. Once fired the new stream starts playing and is shown in the player. This event is called only when the dynamic configuration property is enabled. The callback is fed with an object argument that has the following properties:

  • streamName - the name of the stream
  • bitrate
  • width

onStreamSwitchFailed(info)

Fires when the server has returned a failure to dynamically switch the video. This is generally due to asynchronous keyframes between the multi-rate videos. As a fallback the bwcheck plugin will attempt a native switch by reloading the video.

  • info - The message returned from the server

Download

flowplayer.bwcheck_httpstreaming-3.2.13.swf

just the working flash file to get you going

flowplayer.bwcheck_httpstreaming-3.2.13.zip

working flash file (swf) + README.txt and LICENSE.txt

flowplayer.bwcheck_httpstreaming-3.2.13-src.zip

source code

Please right-click and choose "Save link as..." (or similar)

Note: For XSS security reasons Flash plugins must be located at and loaded from the same domain as the core player flowplayer-3.2.18.swf.

This is a Flash plugin, and its features are therefore not available on iOS. For iOS please consult the ipad plugin.

See the version history for this tool.

Found a bug?

If you encounter problems with this script, please turn to the Flowplayer Flash plugin forum with a link to a minimal sample page (no extra html, css, javascript) demonstrating the issue.