从多个预加载视频获取元数据
我发现我只能获取我点击的第一个视频的元数据。元数据如何运作?视频结束前只能加载一次?
这是我正在做的一些示例,
//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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否试图在不启动视频加载过程的情况下获取元数据?如果是这样,那么仅使用动作脚本是不可能的。也就是说,由于 flv 是渐进加载的,因此您无需加载整个视频即可获取元数据。您可以加载每个视频,并在获得元数据后停止加载。
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.