2 Replies Latest reply on Feb 2, 2011 7:48 AM by RandomReado

    Using my own NetStream with VideoPlayer

    RandomReado Level 1

      Is it possible to use your own NetStream with the VideoPlayer component, or would I have to build my own video player to do so?

       

      Here's  why... I'm using RTMP with Wowza and I want to stream a video but start  from 0:30, ending at 1:00. Effectively the player would only see a 30  second clip. According to their forums, I could do  NetStream.play('video', 30, 30) but I'd need to attach the NetStream to  the video player as the source.

        • 1. Re: Using my own NetStream with VideoPlayer
          mraak Level 1

          I'd need to attach the NetStream to  the video player as the source.

           

          That seems about right. Where's the problem?

          • 2. Re: Using my own NetStream with VideoPlayer
            RandomReado Level 1

            It doesn't work. There's audio but no video and the play/pause button and scrub bar doesn't change when the source is changed to the NetStream. I am using the latest Flex Hero release by the way.

             

            Here's the code:

             

            nc = new NetConnection();
            nc.connect('rtmp://10.1.1.117/vod');
            nc.addEventListener(NetStatusEvent.NET_STATUS, nc_netStatus);
            
            function nc_netStatus(e:NetStatusEvent):void
            {
                var nsClient:Object = {};
                nsClient.onMetaData = ns_onMetaData;
                nsClient.onCuePoint = ns_onCuePoint;
                
                ns = new NetStream(nc);
                ns.play('mp4:1095.mp4', 0, 5);
                ns.client = nsClient;
                
                videoPlayer.source = ns;
            }
            
            function ns_onMetaData(o:Object):void
            {
            }
            
            function ns_onCuePoint(o:Object):void
            {
            }
            

             

            Instead of changing the source, if I do the following instead it works fine.

             

            //videoPlayer.source = ns;
            
            vi = new Video(852, 504);
            vi.attachNetStream(ns);
            
            // mx:UIComponent
            uic.addChild(vi);
            uic.width = 852;
            uic.height = 504;
            

             

            However there's no player controls or scrub bar, so I'd have to do this myself, unless there's a way to get the VideoPlayer to work?