4 Replies Latest reply on Feb 16, 2010 9:54 AM by WebAppEngineer

    Add var to stream name and play again

    WebAppEngineer Level 1

      I have an unusual situation. I’m using a CDN plugin I built not unlike the sample one. I have a situation where I need to tack a variable on to the stream name before telling the netstream to play it. Based on the user interaction, I will also have to change the value of this variable and re-request / play the stream.

      How would this best be accomplished? Could one use metadate? If so how exactly?

        • 1. Re: Add var to stream name and play again
          bringrags Level 4

          Any query parameters that are appended to the resource URL are appended to the stream name that's passed to NetStream.play.  Can you include these parameters in the URL prior to playback?  Or is your case more complicated than that?  (If the latter, any details you can add would be helpful.)

          • 2. Re: Add var to stream name and play again
            WebAppEngineer Level 1

            Thank you for your reply and assist.

             

            Currently that is what I’m doing. But it is a bit more complicated. Without getting to the details of why, I need to be able to restart. Meaning I need to have netstream re-request/load the stream a second time the only change is to the value associated with this appended variable.

             

            Currently I simple create a new media element with the same URL path. I just update the variable/parameter being passed in. But it seems to me that that is a lot of unnecessary overhead. OSMF has already created a connection and requested the stream once. It would seem more efficient to somehow update the variable/parameter without recreating everything. Then somehow tell the netsteam it request/load the stream again but with the updated variable appended.

            • 3. Re: Add var to stream name and play again
              bringrags Level 4

              One approach you could try is to unload the MediaElement, change its URL (by changing its URLResource), then reload it.  (You can't unload directly from the MediaPlayer class, so you'd need to access the LoadTrait of the MediaElement.)  Currently this won't completely solve the problem, since we'll close the NetConnection when you unload the MediaElement, but we're planning to provide greater control over whether a NetConnection is closed when the last MediaElement to use it release it.  More discussion (plus the bug #) on this issue can be found here:

               

              http://forums.adobe.com/message/2401091

              • 4. Re: Add var to stream name and play again
                WebAppEngineer Level 1

                Okay, that clarifies things for me. Thanks again.