Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make use of play2() function in order to perform fast stream switching of videos?
    primarykey
    data
    text
    <p>I am currently working on a Flash webplayer with resolution switching functionality. I am trying to make use of the NetStream class's <code>play2()</code> function in Actionscript.</p> <p>The problem I am running into is that the videos don't change quickly. For those familiar with the <code>play2()</code> function I believe that the player is performing a <code>"standard switch"</code> rather than a <code>"fast switch."</code></p> <p><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStreamPlayOptions.html#offset">The documentation says that</a> when the offset parameter is -1, fast switching occurs. What actually happens, though is once the <code>"NetStream.Play.Transition"</code> event is received, the player waits until the time denoted by <code>ns.time + ns.bufferLength</code> has been reached, before performing the switch.</p> <p>I thought fast switching cleared the buffer, but on a check to <code>ns.backbufferlength</code>, I found that everything is still cached. Also it mentions: "When offset is -1, the switch occurs at the first available keyframe after <code>netstream.time + 3</code>," which is why I am confused.</p> <p>Any help/insight on this matter would be much appreciated.</p> <p>Here is a snippet of code describing what is going on (<code>newStream()</code> is called when a user clicks to change to a new resolution, youtube style):</p> <pre><code>public function newStream(address:String):void { var opts:NetStreamPlayOptions = new NetStreamPlayOptions(); opts.streamName = address; opts.transition = NetStreamPlayTransitions.SWITCH; opts.offset = -1; ns.play2(opts); } private function nsCallback(event:NetStatusEvent) { switch(event.info.code) { case "NetStream.Play.Transition": { trace("Current time (on Transition): " + ns.time, "Buffer: " + ns.bufferLength); var estTime:Number = ns.time + ns.bufferLength; trace("Estimated Completion Time: " + estTime); break; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload