4 Replies Latest reply: Mar 20, 2012 3:42 PM by griley64 RSS

    maxAllowedDynamicStreamIndex not used by NetStreamSwitchManager

    griley64

      Hi,

       

      I'm using OSMF 1.5 and am trying to limit set the maxAllowedDynamicStreamIndex.  I'm setting it in a listener when a DynamicStream capability is added:

       

                     private function onCapabilityChange(event:MediaPlayerCapabilityChangeEvent):void
                     {
                          trace("onCapabilityChange(): type=" + event.type + " enabled=" + event.enabled);
                          if ((event.type == MediaPlayerCapabilityChangeEvent.IS_DYNAMIC_STREAM_CHANGE) && (event.enabled)) {
                               mediaPlayer.maxAllowedDynamicStreamIndex = asset.getMaxStreamIndexForDimensions(mediaHolder.width,mediaHolder.height);
                               trace("max stream index set to:" + asset.getMaxStreamIndexForDimensions(mediaHolder.width,mediaHolder.height));
                          }
                     }
      

       

      After noticing that the MediaPlayer continued to exceed the maxAllowedIndex when running its switching rules (checking for bandwidth , buffer etc).  I managed to sniff my way into the NetStreamSwitchManger which seems to completely ignore the setting that is made in the mediaPlayer and DynamicStreamTrait and instead it simply uses the number of streams defined in the DynamicStreamingResource.

       

      I've seen a few posts that seem to imply that this should just simply work - but after looking at the code in OSMF 1.5 I can't see how.

       

      Am I missing something?  Is this fixed in OSMF 1.6?

        • 1. Re: maxAllowedDynamicStreamIndex not used by NetStreamSwitchManager
          Silviu Vergoti Adobe Employee

          Can you check the stream in Strobe media playback? it allows you to give the value as a flashvare, ex:

          .../debug.html?maxAllowedDynamicStreamIndex=2&optimizeInitialIndex=false

          • 2. Re: maxAllowedDynamicStreamIndex not used by NetStreamSwitchManager
            griley64 Community Member

            Hi Sliviu,

             

            I'm not using a SMIL file so I don't believe there is a way for me to use the Strobe debug playback.

             

            I'm using Akamai's Advanced Streaming Plugin for OSMF 1.5 and creating a DynamicStreamResource with associated DynamicStreamItems by hand.  The RTMP streams work and bandwidth switching does as well.  However, it seems to me that any call to mediaPlayer.maxAllowedDynamicStreamIndex = x is completely ignored by the NetStreamSwitchManager.

             

            I'm not entirely sure of what Strobe's relationship is to OSMF - if the maxAllowedDynamicStreamIndex is honored in Strobe, perhaps I should take a peek at the code.

            • 3. Re: maxAllowedDynamicStreamIndex not used by NetStreamSwitchManager
              Silviu Vergoti Adobe Employee

              Hi,

               

              SMP is included in the OSMF sources. The line I provided turns off the initial optimization for switching, so it should be OSMF-only behavior.

               

              Regarding the plugin, it could cause different behavior - have you talked with Akamai?

              • 4. Re: maxAllowedDynamicStreamIndex not used by NetStreamSwitchManager
                griley64 Community Member

                This turned out to be a bug in OSMF's composite dynamic stream traits.

                 

                The project I'm working on requires a VideoElement to be embedded within a SerialElement.

                 

                ParallelDynamicStreamTrait and SerialDynamicStreamTrait do not pass the maxAllowedIndex information along to the child's NetStreamSwitchManager thus completely ignoring any change you might make via mediaPlayer.maxAllowedDynamicStreamIndex = x.

                 

                I ended up modifying the OSMF source and adding the following methods to SerialDynamicStreamTrait and ParallelDynamicStreamTrait:

                 

                SerialDynamicStreamTrait

                          override protected function maxAllowedIndexChangeStart(newIndex:int):void
                          {
                               (traitOfCurrentChild as DynamicStreamTrait).maxAllowedIndex = newIndex;
                          }
                
                

                 

                ParallelDynamicStreamTrait

                          override protected function maxAllowedIndexChangeStart(newIndex:int):void
                          {
                                    traitAggregator.forEachChildTrait(
                               function(mediaTrait:DynamicStreamTrait):void
                               {
                                    mediaTrait.maxAllowedIndex = newIndex;
                               }
                               ,   MediaTraitType.DYNAMIC_STREAM
                          );
                          }
                

                This is not an ideal solution but to properly refactor would be a large underataking.