There are two ways to find the end of the file using action script for the flv files.
- Using meta data (which we will get by getting meta event onMetaData)
- Using netStatus code "NetStream.Play.Stop"
Getting duration of the file:
public function onMetaEvent(mdata:Object):void { //taking the duraiton time for looping lastPosition = mdata.duration; }Finding the end of the file:
public function netStatus(item:Object):void { //Unpause.Notify code will be generated whenever buffer fills with data if (item.info.code == "NetStream.Unpause.Notify") { if (Math.floor(stream.bufferLength) >= Math.floor(lastPosition)) { //buffer length reaches end of the file } } }Using netStatus code "NetStream.Play.Stop" : Here we need to check for the NetStream status code Play.Stop. as shown in the below sample code.
public function netStatus(item:Object):void { if (item.info.code == "NetStream.Play.Stop") { //reaches end of the file } }For more NetStream status codes click here.
No comments:
Post a Comment