在localhost RED5路径问题AS3 RTMP视频流 [英] as3 rtmp video stream on localhost red5 path issue

查看:670
本文介绍了在localhost RED5路径问题AS3 RTMP视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是在AS3一个基本的code位flash.A简单的视频流媒体使用RTMP red5的例子。但我似乎到现在用的是相同的视频文件与RED5服务器演示安装,可给予其连接到stream.I问题。(我已经通过正常运行它验证了安装ofla的演示) 我的输出走线描绘出作为连接成功和视频文件的播放开始。但我无法得到它的元数据或得到它其实玩。

Below is a basic code bit in as3 flash.A simple video streaming example using rtmp red5. But i seem to be having issues connecting to the stream.I am using the same video files as given with the red5 server demo installation.( i have verified the installed demo of ofla by running it properly) my output trace traces out as a connection success and the play start of the video file. But i am unable to get its metadata or get it actually playing.

的netStatusHandler值为NetConnection.Connect.Success

netStatusHandler NetConnection.Connect.Success

的netStatusHandler NetStream.Play.Reset

netStatusHandler NetStream.Play.Reset

的netStatusHandler NetStream.Play.Start

netStatusHandler NetStream.Play.Start

我是什么在这里失踪的问候到视频文件提供的路径?它们位于它们配备的是默认的RED5安装相同的演示示例文件夹。

what am i missing here in regards to giving the path to the video file ? they are located in the same demo example folder which come with the default red5 installation.

package 
{
    import flash.display.*;
    import flash.events.*;
    import flash.media.*;
    import flash.net.*



    public class NetConnectionExample extends MovieClip
    {
        private var videoURL:String = "rtmp://localhost/oflaDemo/streams";
        private var connection:NetConnection;
        private var stream:NetStream;
        public function NetConnectionExample()
        {
            // constructor code
            connection = new NetConnection();
            connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            connection.connect(videoURL, true);
        }
        private function netStatusHandler(event:NetStatusEvent):void
        {
            trace("netStatusHandler",event.info.code);
            switch (event.info.code)
            {
                case "NetConnection.Connect.Success":
                    connectStream();
                    break;
                case "NetStream.Play.StreamNotFound":
                    trace("Stream not found: " + videoURL);
                    break;
                case "NetStream.Play.Start":
                break;
            }
        }

        private function securityErrorHandler(event:SecurityErrorEvent):void
        {
            trace("securityErrorHandler: " + event);
        }

        private function connectStream():void
        {
            stream = new NetStream(this.connection);
            stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler)
            stream.client = new CustomClient();
            var video:Video = new Video();
            video.attachNetStream(stream);
            stream.play(videoURL+"avatar.flv");
            addChild(video);
        }
        function asyncErrorHandler(event:AsyncErrorEvent):void {
            // ignore AsyncErrorEvent events.
        }

    }
}

class CustomClient {
public function onMetaData(info:Object):void
{
    trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
}
public function onCuePoint(info:Object):void
{
    trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
}
}

编辑: 有关 <一href="http://stackoverflow.com/questions/2061923/where-do-i-place-a-flv-file-to-stream-on-a-local-red5-server">Where做我把一个FLV文件流本地的Red5服务器上?

Related Where do I place a FLV file to stream on a local Red5 server?

推荐答案

这是一个路径问题。应用程序的呼吁oflaDemo的RTMP视频文件夹命名为流。 让像这样的路径

It was a path issue. the rtmp video folder of the application called oflaDemo is named streams. giving the path like so

 private var videoURL:String = "rtmp://localhost/oflaDemo";

和直接连接的流文件名之后。作品

and directly the file name after connecting the stream. works

 stream.play("avatar.flv");

这篇关于在localhost RED5路径问题AS3 RTMP视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆