1 Reply Latest reply on Aug 6, 2007 1:50 PM by d3v15

    NetStream VideoDisplay

    jamierytlewski
      I am new to Flex and was wanting to know if it was possible to use both NetStream and the VideoDisplay component together. And if not, how do you display a NetStream on the Flex app? I have looked at the ActionScript 3 code, and tried different ways. I am trying to use NetStream so that I can get the current time of the video. I am not getting the videos from a streaming server or anything, but I just need the current time of the movies. Any help would be appreciated.

      Thanks,

      Jamie
        • 1. NetStream VideoDisplay
          d3v15
          Wow - 3/2007. Pretty nice forum we have here -

          if your question still stands, [flex 2] flex doesn't allow you direct access to the netsream object (or any required objects) through the videodisplay. There is a fix mentioned at
          http://www.cynergysystems.com/blogs/page/keunlee?entry=flex_2_videodisplay_security_sandbo x
          that basically makes all members public so that you have access, but it doesn't seem to work form me.

          The other way is create your own.

          private function connectStream():void{
          screenHolder.removeAllChildren(); // a grid item - or any container you need

          // create screen
          var screen:UIComponent = new UIComponent();
          screen.setActualSize(770, 395);
          screen.id = "vdoScreen";

          // assign video to screen
          this.vido = new Video(770, 395);
          this.vido.x = 0;
          this.vido.y = 0;
          this.vido.deblocking = 1;
          screen.addChild(vido);

          // associate screen to holder
          screenHolder.addChild(screen);

          // Net stream - Close and recreate stream
          if (ns) ns.close();
          ns = new NetStream(nc);
          ns.bufferTime = startBufferLength;

          // attach handler to net stream - with any events
          ns.client = nsc;
          ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
          ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);

          // attach stream to video
          this.vido.attachNetStream(ns);

          // play the stream
          ns.play("20051210-w50s_56K", 0);
          ns.seek(0);

          // play bar handler
          //addEventListener(Event.ENTER_FRAME, onPlayHeadUpdate);
          //playBar.addEventListener(SliderEvent.THUMB_DRAG, onScrubDrag);
          playBar.addEventListener(SliderEvent.THUMB_PRESS, onScrubStart);
          playBar.addEventListener(SliderEvent.THUMB_RELEASE, onScrubEnd);
          }

          This works fine. The major problem is that you loose a lot of "so called functionality'" of the videodisplay object. The major feature i miss is adding cue points - which doesn't seem possible with a netsream or video object only. And this is dumb.

          It seems to me that flex is two products: A templating engine, as well as a coding environment, and these two should be separated. There should never be a time that flex limits standard AS2/3 functionality to a programmer. This is definately a major flaw.