0 Replies Latest reply on Oct 20, 2010 7:47 PM by mattparisi

    OSMF custom netstream behavior

    mattparisi

      Hi Everyone, I have been coding using the OSMF framework for a while now with the tremendous help of Brian Riggs, who's been a life-saver every time i went to him with an issue.  I have one final issue, perhaps the biggest thus far and I'm hoping someone here can shed light on what I'm missing.  I have a unique use case where I'm required to have a live stream going from a camera and at any point during this live feed, a user has the option to inject a pre-recorded video into the live feed.  What happens, is that the onMetaData triggers from the VOD and throws everything out of whack.  I basically need this live feed to keep broadcasting uninterrupted, even though vods are being injected at will.  So my question is,  how do I use a ProxyElement to remove the onMetaData listeners from the netstream object, regardless of the MediaElement.  Here's what I have in my ProxyElement, but it doesn't work.  The onMetaData in LightweightVideoElement is still being triggered...  setup() is called from the proxiedElement setter.

       

      private function setup(element:MediaElement):void

      {

      if(element == null)return;

      var loadTrait:NetStreamLoadTrait = this.getTrait(MediaTraitType.LOAD) as NetStreamLoadTrait;

      loadTrait.addEventListener( LoadEvent.LOAD_STATE_CHANGE, onLoadStateChange);

      addTrait(MediaTraitType.LOAD, loadTrait);

      }

      public function onLoadStateChange(evt:LoadEvent):void

      {

      if(evt.loadState == LoadState.READY)

      {

      _stream = evt.target.netStream;

      if(_stream)

      {

      _stream.client = new NetClient();

       

      addTrait(MediaTraitType.PLAY, new WebcasterPlayTrait(_stream, this.resource));

       

      var timeTrait:WebcasterTimeTrait = new WebcasterTimeTrait(_stream, evt.target.resource);

       

      addTrait(MediaTraitType.TIME, timeTrait);

       

      addTrait(MediaTraitType.AUDIO, new NetStreamAudioTrait(_stream));

      addTrait(MediaTraitType.BUFFER, new WebcasterBufferTrait(_stream));

      addTrait(MediaTraitType.SEEK, new WebcasterSeekTrait(timeTrait));

         

      var video:Video = new Video();

      video.smoothing = true;

      video.width = video.height = 0;

       

      video.attachNetStream(_stream);

       

      addTrait(MediaTraitType.DISPLAY_OBJECT, new NetStreamDisplayObjectTrait(_stream, video, NaN, NaN));

       

      this.addMetadata(EnterpriseConstants.ENTERPRISE_METADATA_NAMESPACE, new EnterpriseMetadata());

      NetClient(_stream.client).addHandler("KillStream", handleKillStream);

      NetClient(_stream.client).addHandler("ScriptCommand", handleScriptCommand);

      NetClient(_stream.client).addHandler('OverlayCommand', handleOverlayCommand);

      NetClient(_stream.client).addHandler(NetStreamCodes.ON_META_DATA, handleMetadata);

       

      //super.blockedTraits = new Vector.<String>();

      }

      }

      }

       

      Am I even remotely close to getting this right?  Can it even be done?  Thoughts/solutions would be greatly appreciated.

       

      Thanks!