开发者

Getting metadata from multiple preloading video

开发者 https://www.devze.com 2023-01-28 09:29 出处:网络
I found out that I could only get the metadata of the 1st video I clicked. How does metadata works? It could only load once before the video ends?

I found out that I could only get the metadata of the 1st video I clicked. How does metadata works? It could only load once before the video ends?

Here's some example what I'm doing

//will be adding new video when this function is called
public function set newVideo():void
{
    videoProperties();
}

public function videoProperties():void
{
    meta=new Object()
    nc = new NetConnection();
    nc.connect(null);
    ns = new NetStream(nc);

    nsArray[dList.currentIndex] = ns;
    nsi = nsArray[dList.currentIndex];
    // Add the buffer time to the video Net Stream
    nsi.bufferTime = buffer;

    // Set client for Meta Data Function
    nsi.client = {};
    nsi.client.onMetaData = onMetaData;
    nsi.addEventListener(AsyncErrorEvent.ASYNC_ERROR,asyncErrorHandler);
    nsi.addEventListener(NetStatusEvent.NET_STATUS, onNetStatusEvent);

    nsi.play(videoURL);
    nsi.pause();
    nsi开发者_如何转开发.seek(-1);
}

private function onMetaData(info:Object):void
{
    //some video duration calculations
}

I tried to load all the metadata at once, but seems like it needs the video to be play only it will manage to get the metadata.


Are you trying to get the metadata without starting the video loading process? If so, that's not possible with actionscript alone. That said, since flvs load progressively you don't need to load an entire video to get at the meta data. You can load each video and stop loading it when you've got the metadata.

0

精彩评论

暂无评论...
验证码 换一张
取 消