3 Replies Latest reply on Jun 23, 2010 4:37 PM by bringrags

    DVR Streaming

    Amit Kumar Adobe Employee

      Hi

       

      I have a set of dvr streams of different bitrates and I want to dynamically switch based on bandwidth. I am using OSMF player sprint 10 for streaming recorded videos. Can anyone provide some help using sample codes how to go about DVR MBR switching.

       

      Regards,

      Amit

        • 1. Re: DVR Streaming
          bringrags Level 4

          The Example Usage section of the DVR spec has details on how to play DVR content:

           

          http://opensource.adobe.com/wiki/display/osmf/DVR+Support+Specification

           

          Once you've created the MediaElement, assign it to MediaPlayer.media.  The MediaPlayer class exposes an API for MBR switching.

           

          http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/org/osmf/media/MediaPla yer.html?allClasses=1

           

          By default autoDynamicStreamSwitch is true, so it will automatically switch based on your bandwidth, buffer, etc.  Set this to false to be able to switch manually (see the switchDynamicStreamIndex method).  There are other events and properties that are relevant (look for the ones with "dynamicStream" in their names).

          • 2. Re: DVR Streaming
            Amit Kumar Adobe Employee

            Thanks Brian the links were a great help and finally I am to perform what I wanted in Flash CS4. But when I was using the sprint 10 sample OSMFPlayer given in apps/samples/framework/OSMFPlayer it was not working. I just added few lines in method loadURL of OSMFPlayer.as:

             

            private

             

             

            function loadURL(url:String):void

            {

             

             

            //updateTargetElement(factory.createMediaElement(new URLResource(url)));

             

             

            /*var resource : DynamicStreamingResource = new DynamicStreamingResource ( "rtmp://10.10.10.10/vod", null) ;

            var vector : Vector.<DynamicStreamingItem> = new Vector.<DynamicStreamingItem> ( 3 ) ;

            vector [ 0 ] = new DynamicStreamingItem ( "mp4:sample1_1500kbps.f4v" , 1500 ) ;

            vector [ 1 ] = new DynamicStreamingItem ( "mp4:sample1_150kbps.f4v" , 150 ) ;

            vector [ 2 ] = new DynamicStreamingItem ( "mp4:sample1_500kbps.f4v" , 500 ) ;*/

             

             

             

             

            var resource : DynamicStreamingResource = new DynamicStreamingResource ( "rtmp://10.10.10.10/dvrcast_edge", StreamType.DVR) ;

             

            var vector : Vector.<DynamicStreamingItem> = new Vector.<DynamicStreamingItem> ( 3 ) ;

            vector [ 0 ] =

            new DynamicStreamingItem ( "mp4:sample1.f4v" , 2000 ) ;

            vector [ 1 ] =

            new DynamicStreamingItem ( "mp4:sample2.f4v" , 1000 ) ;

            vector [ 2 ] =

            new DynamicStreamingItem ( "mp4:sample3.f4v" , 800 ) ;

             

            resource.streamItems = vector ;

            updateTargetElement(factory.createMediaElement(resource));

            }

             

            So I was able to do MBR switching for VOD streams using commented code in green but when I tried it with DVR streams it was not working any idea why its happening?

             

            Regards,

            Amit

            • 3. Re: DVR Streaming
              bringrags Level 4

              The code looks correct.  I assume you have the server-side DVRCast application running on the server?  (OSMF DVR requires that.)  To dig deeper, I would recommend looking at the return value of the MediaFactory.createMediaElement call to ensure that you're getting a DVR-enabled VideoElement.  (To do this, I would check the value in the debugger and make sure it's a VideoElement whose loader property is a DVRCastNetLoader.)