0 Replies Latest reply on Jan 19, 2011 2:39 PM by drkstr_1

    Streaming Video with Spark VideoPlayer

    drkstr_1 Level 4

      Hello,

       

      I'm starting to work with the Flash Media Server for the first time, and I'm having trouble determining if the Spark VideoPlayer component is streaming my video correctly or not.

       

      First of all, I'm following the tutorial here to set up the stream:

       

      http://www.adobe.com/devnet/flashmediaserver/articles/beginner_as3_fm3.html

       

       

      When I run the example fla, I can see there is a buffer amount which appears to me like the video is streaming as expected.

       

      (relevent code in FLA)

       

      var nc:NetConnection = new NetConnection();
      nc.connect("rtmp://localhost/VideoTest");
      
      var ns:NetStream = new NetStream(nc);
      
      nc.onStatus = function(ncObj:Object)
      {
           trace(ncObj.code);
           if (ncObj.code == "NetConnection.Connect.Success")
           {
                ns.setBufferTime(2);
                myVideo.attachVideo(ns);
                ns.play("mp4:Vultures");
           }
      };
      

       

       

      However, when I copied this functionality to the Spark VideoPlayer component, the video doesn't appear to buffer as it goes.

       

           <fx:Script>
                <![CDATA[
                     import org.osmf.events.LoadEvent;
      
                     protected function videoPlayer_bytesLoadedChangeHandler(event:LoadEvent):void
                     {
                          trace("VideoTest.videoPlayer_bytesLoadedChangeHandler(event)");
                     }
      
                ]]>
           </fx:Script>
           
           <s:VideoPlayer id="videoPlayer" bytesLoadedChange="videoPlayer_bytesLoadedChangeHandler(event)" > 
                <s:DynamicStreamingVideoSource host="rtmp://localhost/VideoTest" > 
                     <s:DynamicStreamingVideoItem streamName="mp4:Vultures"/> 
                </s:DynamicStreamingVideoSource> 
           </s:VideoPlayer>
      

       

      When the app runs, videoPlayer_bytesLoadedChangeHandler is called only once and I do not see any buffering indicator in the player control. The video is playing fine.

       

       

      Is the video just buffering really quick because I'm running from localhost? If so, why does the original example appear to buffer? Does it have something to do with ns.setBufferTime(2);? Is their an equivilent setting using the VideoPlayer component (I didn't see one in the API reference)? If not, what is a good way to test video streaming from localhost?

       

       

      Thanks for your time!