【问题标题】:Error #2044: Unhandled NetStatusEvent错误 #2044:未处理的 NetStatusEvent
【发布时间】:2014-08-28 21:17:48
【问题描述】:

我不确定为什么会出现以下错误。您能否建议在我的舞台上成功播放 rtmp 流需要对我的代码进行哪些更改? 错误:

NetConnection.Connect.Success 错误 #2044:未处理的 NetStatusEvent:。 级别=错误,代码=NetStream.Play.StreamNotFound 在 main/attachnetstream()[/Users/user/Desktop/ojotha/main.as:24] 调试 会话终止。

package  {
    import flash.display.MovieClip;
    import flash.net.*;
    import flash.events.NetStatusEvent;
    import flash.media.Video;

    public class main extends MovieClip {
    public var streamserver:String="rtmp://216.245.200.114/live";
    public var streamname:String="shomoy";
    public var netconnection:NetConnection=new NetConnection();

        public function main() {
            netconnection.connect(streamserver);
            netconnection.addEventListener(NetStatusEvent.NET_STATUS, attachnetstream);




        }
        public function attachnetstream(event:NetStatusEvent):void{
            trace(event.info.code);
            switch (event.info.code) {
                case "NetConnection.Connect.Success":
                var netstream:NetStream=new NetStream(netconnection);
                var video:Video=new Video();
                video.attachNetStream(netstream);
                netstream.play(streamname);
                video.height=480;
                video.width=640;
                addChild(video);

                break;
                case "NetStream.Play.StreamNotFound":
                trace("stream not found");
                break;
            }
                }


            }

    }

【问题讨论】:

  • 你试过rtmp://216.245.200.114/live/我的意思是结束斜线,我之前有同样的问题并且解决了它
  • 看到这个也可以帮助stackoverflow.com/questions/24233131/…
  • 我已经尝试使用斜线,但结果相同:错误 #2044:未处理的 NetStatusEvent:。 level=error, code=NetStream.Play.StreamNotFound at main/attachnetstream()[/Users/user/Desktop/ojotha/main.as:25] 调试会话终止。
  • 只是说.. 确保确实有正在广播的流。仅服务器 URL 是不够的。如果流已连接(找到),您希望看到什么?也在这里测试它 [Wowza RTMP Tester]。您可以先尝试 Server = rtmp://cp79650.live.edgefcs.net/live/Stream = QVCLive1@14308 ,如果现在可以尝试您的。也许您的代码很好,但它只是服务器/广播问题?

标签: actionscript-3 flash


【解决方案1】:

您也应该将 NetStatusEvent 事件侦听器添加到您的流中。

stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

docs

您可能还需要设置另一个事件侦听器,即使它为空,以防止出现其他一些运行时错误。

stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多