Error #2044: 未处理的 AsyncErrorEvent:。 text=Error #2095: flash.net.NetStream 无法调用

简介:

AsyncErrorEvent:。 text=Error #2095: flash.net.NetStream 无法调用回调 onMetaData。 error=ReferenceError: Error

问题:Error #2044: 未处理的 AsyncErrorEvent:。 text=Error #2095: flash.net.NetStream 无法调用回调 onMetaData。 error=ReferenceError: Error #1069:找不到属性 onMetaData,且没有默认值。

解决方法:

加载并播放外部flv文件,想获取总时间,得如上错误提示。

// 创建回调函数的对象
var customClient:Object = new Object();
customClient.onMetaData = metaDataHandler;

// 赋值给NetStream对象的属性client

var my_nc:NetConnection=new NetConnection();
my_nc.connect(null);
var my_ns = new NetStream(my_nc);
my_ns.client = customClient;
my_ns.play("mov1.flv");

//onMetaData回调函数的事件
function metaDataHandler(infoObject:Object):void {
//获得flv文件中嵌入的描述性信息,这里获得获得总持续时间(单位:秒)
var flv_duration:Number = int(infoObject.duration);
var tM:Number = Math.floor(flv_duration/60);
var tS:Number = Math.floor(flv_duration%60);
time_txt.text="总长:"+tM+":"+tS;

}

红色为解决问题的部分

——————————————————————————————————

官方例子:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/03/01/displaying-a-video-in-flex-using-the-netconnection-netstream-and-video-classes/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
creationComplete="init();">

<mx:Script>
<![CDATA[
import mx.utils.ObjectUtil;

private var nc:NetConnection;
private var ns:NetStream;
private var video:Video;
private var meta:Object;

private function init():void {
var nsClient:Object = {};
nsClient.onMetaData = ns_onMetaData;
nsClient.onCuePoint = ns_onCuePoint;

nc = new NetConnection();
nc.connect(null);

ns = new NetStream(nc);
ns.play("http://www.helpexamples.com/flash/video/cuepoints.flv");
ns.client = nsClient;

video = new Video();
video.attachNetStream(ns);
uic.addChild(video);
}

private function ns_onMetaData(item:Object):void {
trace("meta");
meta = item;
// Resize Video object to same size as meta data.
video.width = item.width;
video.height = item.height;
// Resize UIComponent to same size as Video object.
uic.width = video.width;
uic.height = video.height;
panel.title = "framerate: " + item.framerate;
panel.visible = true;
trace(ObjectUtil.toString(item));
}

private function ns_onCuePoint(item:Object):void {
trace("cue");
}
]]>
</mx:Script>

<mx:Panel id="panel" visible="false">
<mx:UIComponent id="uic" />
<mx:ControlBar>
<mx:Button label="Play/Pause" click="ns.togglePause();" />
<mx:Button label="Rewind" click="ns.seek(0); ns.pause();" />
</mx:ControlBar>
</mx:Panel>

</mx:Application>




本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/archive/2009/12/15/1624486.html,如需转载请自行联系原作者

相关文章
|
网络安全
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://xxxx.svc.cluster.local:8080/xxxx": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "xxxx.svc.cluster.local:8080/xxxx ": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
2161 0
|
3月前
|
Oracle 关系型数据库
Navicat 连接Oracle ORA-28547: connection to server failed, probable Oracle Net admin error
Navicat 连接Oracle ORA-28547: connection to server failed, probable Oracle Net admin error
112 0
加载模型出现-RuntimeError: Error(s) in loading state_dict for Net:unexpected key(s) in state_dict: XXX
加载模型出现-RuntimeError: Error(s) in loading state_dict for Net:unexpected key(s) in state_dict: XXX
546 0
|
Java 容器
RestTemplate报错I/O error on POST request for "http://crmjob.xxx.xxx.com/removeJob": Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out问题处理
讲述RestTemplate报错I/O error on POST request for "http://crmjob.xxx.xxx.com/removeJob": Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out处理方案
|
6月前
|
监控 应用服务中间件
idea debug模式启动Tomcat报错:Error running ‘tomcat8‘: java.net.SocketException “socket closed“
idea debug模式启动Tomcat报错:Error running ‘tomcat8‘: java.net.SocketException “socket closed“
216 0
|
6月前
|
分布式计算 Linux Spark
【已解决】Caused by: java.net.SocketException: Connection reset by peer: socket write error
【已解决】Caused by: java.net.SocketException: Connection reset by peer: socket write error
213 0
|
11月前
DevTools failed to load source map: Could not load content for…System error: net::ERR_FILE_NOT_FOUN
DevTools failed to load source map: Could not load content for…System error: net::ERR_FILE_NOT_FOUN
|
Java 关系型数据库 MySQL
14. 成功解决:ERROR:ssl_client_socket_impl.cc(992) handshake failed; returned -1, SSL error code 1, net_error -103
今天使用 Python 的 selenium 时,一直在报如下错误:[30616:22540:0328/093748.004:ERROR:ssl_client_socket_impl.cc(992)] handshake failed; returned -1, SSL error code 1, net_error -100
4206 0
|
Android开发
Error running Android Debugger (8600): Unable to open debugger port (localhost:8600): java.net.Conne
Error running Android Debugger (8600): Unable to open debugger port (localhost:8600): java.net.Conne
253 0
|
网络虚拟化
pip安装torchvision报错ProxyError: Conda cannot proceed due to an error in your proxy configuration. ———————————————— 版权声明:本文为CSDN博主「山顶夕景」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_35812205/article/details/119078793
报错:ProxyError: Conda cannot proceed due to an error in your proxy configuration. 提示:Check for typos and other configuration errors in any ‘.netrc’ file in your home directory, any environment variables ending in ‘_PROXY’, and any other system-wide proxy
936 0