Optimizing delivery with Dynamic (MBR) Streaming for HTTP and RTMP streams

Delivery quality, specifically how well a player responds to bandwidth changes, is a key differentiator of media players. Dynamic Streaming helps your player adapt to changing network conditions.

With Dynamic Streaming, when the player senses a network bandwidth change, it responds by switching playback to a content file with a more appropriate bit rate. Dynamic Streaming requires you to have multiple bit rate (MBR) versions of content for the player to switch among. When you provide MBR content, a network experiencing a temporary reduction in bandwidth does not have to pause playback for the user. Instead, the player shifts to using a lower bit rate version of the content that is playing. If the player does not find multi-bitrate versions of content, Dynamic Streaming does not function.

To enable HTTP Dynamic Streaming, you supply OSMF with an F4M file, as described in these Quick Start tutorials.

For RTMP Dynamic Streaming, you can use MediaPlayerSprite and DynamicStreamingResource as shown in the following sample. DynamicStreamingResource contains multiple DynamicStreamingItem values, each of which represents a single stream.

package 
{ 
    import flash.display.Sprite; 
    import flash.display.StageAlign; 
    import flash.display.StageScaleMode; 
    import org.osmf.elements.VideoElement; 
    import org.osmf.media.MediaPlayerSprite; 
    import org.osmf.net.DynamicStreamingItem; 
    import org.osmf.net.DynamicStreamingResource; 
 
    public class DynamicStreamingExample extends Sprite 
    { 
        public function DynamicStreamingExample() 
        { 
        super(); 
 
            stage.scaleMode = StageScaleMode.NO_SCALE; 
            stage.align = StageAlign.TOP_LEFT; 
 
            var mediaPlayerSprite:MediaPlayerSprite = new MediaPlayerSprite(); 
         
            var videoElement:VideoElement = new VideoElement(); 
 
            /** 
            * By convention, most rtmp URLs do not use file extensions. 
            */ 
            var dynResource:DynamicStreamingResource = new 
                DynamicStreamingResource("rtmp://myserver.net/ondemand"); 
             
            /** 
            * The first two parameters of each DynamicStreamingItem specify 
            * stream name and bitrate and are required. 
            * The second two parameters of each DynamicStreamingItem are optional; 
            * they specify the stream's width and height, in that order. 
            */ 
            dynResource.streamItems = Vector.<DynamicStreamingItem>( 
                [ new DynamicStreamingItem("mp4:myserver/content/ 
                    demo_768x428_24.0fps_408kbps.mp4", 408, 768, 428) 
                , new DynamicStreamingItem("mp4:myserver/content/ 
                    demo_768x428_24.0fps_608kbps.mp4", 608, 768, 428) 
                , new DynamicStreamingItem("mp4:myserver/content/ 
                    demo_1024x522_24.0fps_908kbps.mp4", 908, 1024, 522) 
                , new DynamicStreamingItem("mp4:myserver/content/ 
                    demo_1024x522_24.0fps_1308kbps.mp4", 1308, 1024, 522) 
                , new DynamicStreamingItem("mp4:mmyserver/content/ 
                    demo_1280x720_24.0fps_1708kbps.mp4", 1708, 1280, 720) 
                ]); 
 
            videoElement.resource = dynResource; 
 
            addChild(mediaPlayerSprite); 
            mediaPlayerSprite.media = videoElement; 
        } 
    } 
}