1 Reply Latest reply on May 28, 2010 1:40 PM by iproano

    problem with DynamicStreamingResource indexFromName

    bmishkin

      I ran into a problem using DynamicStreamingResource today, and it took me awhile to solve, thought I would pass along what I learned.

       

      I am using a DynamicStreamingResource instance, with two DynamicStreamingItem's, over rtmpe. We switched to a media server that requires url arguments at the end of the URL, simplified as:

      
      

         var s1:String = 'mp4:/path/to/video_v1.mp4?arg1=val1&arg2=val2'; // had no args previously

         var s2:String = 'mp4:/path/to/video_v2.mp4'?arg1=val1&arg2=val2;

         var my_item:DynamicStreamingItem = new DynamicStreamingItem (s1, bitrate ) ;

         var my_item:DynamicStreamingItem = new DynamicStreamingItem (s2, bitrate ) ;

       

      Before we had url arguments, switching streams via chrome ControlBar and DynamicStreamTrait worked fine. With the URL arguments added, errors were getting thrown from NetStreamSwitchManager in onPlayStatus().

       

      It turned out to be a problem with DynamicStreamingResource indexFromName() that was causing the trouble. In the function, it checks

       

         if (name == _streamItems[i].streamName || "mp4:" + name == _streamItems[i].streamName)

       

       

      but in our case, the name:String parameter was being sent as the url name (with no url arguments), but streamName did include the url arguments. No match was found and indexFromName() was returning -1 in all cases.The simple solution was to rip off the arguments from the streamName and compare that, something like

       

      var shortStreamName:String = _streamItems[i].streamName.split('?')[0];

       

      Just thought I would pass it along, perhaps for a patch down the road.