0 Replies Latest reply on Oct 24, 2012 2:22 PM by Wrentech

    Problems listening to Dynamic Stream Event for Serial Elements


      Hi all,


      I'm serving videos off of FMS 4.5 and dynamically generating an F4M manifest as a StreamingXMLResource, and then assigning it to my media player as an F4MElement. I wanted to be able to see the bitrate change whenever the stream changes, so I am listening to the DynamicStreamEvent.SWITCHING_CHANGE event and accessing the bitrate via:



      mediaPlayer.addEventListener(DynamicStreamEvent.SWITCHING_CHANGE, dynamicStreamChangeListener);



      // OSMF v2.0.2494

      protected function dynamicStreamChangeListener(dse:DynamicStreamEvent):void {

           this.bitrate = mediaPlayer.getBitrateForDynamicStreamIndex(mediaPlayer.currentDynamicStreamIndex);



      This works perfectly until I start getting fancier w/ Serial Elements. We want to play short advertisements at the beginning, so I am creating a SerialElement with two F4MElements - one for the ad, the second for the video.


      Strangely, the listener I defined for the DynamicStreamEvent.SWITCHING_CHANGE event only gets invoked while the first child (advertisement) plays. When the actual video (2nd child) starts playing, I can see the streams changing (I have 3 different streams with different bitrates - I also encoded the videos w/ different watermark text labels so I can tell the difference between them, eg: low/medium/high).


      So, HDS is clearly working, but I can't seem to access the bitrate value since the 2nd child (the actual video) does not seem to dispatch the DynamicStreamEvent.SWITCHING_CHANGE event. It also does not seem to have the dynamicStream Media Trait Type when used inside a SerialElement.


      In terms of trying to find the current bitrate, am I going about it the right way? (eg: listening to the stream change event, and getting the bitrate from the player for the current stream index).


      Thanks very much for your input!