设置 Flash Stream 到媒体服务器
我有 Adobe Media Server 4,并且正在使用 Flash Professional CS5.5 创建流应用程序。 为了进行测试,我使用默认的 Adobe Page,您可以在其中插入流媒体 URL 和流名称以连接到流媒体源,以进行概述。 这是启动时的页面,其中有两个视频块,左侧一个用于广播,右侧一个用于观看流。
这是 AS3 代码:
var bandwidth:int = 0;
var quality:int = 50;
var camera:Camera = Camera.getCamera();
camera.setQuality(bandwidth, quality);
camera.setMode(430,320,15, true);
var video:Video = new Video();
video.attachCamera(camera);
addChild(video);
video.width = 430;
video.height = 320;
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://***");
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
function netStatusHandler(event:NetStatusEvent):void{
if (event.info.code == "NetConnection.Connect.Success")
{
label10.text = 'Connected';
var ns:NetStream = new NetStream(nc);
ns.attachCamera(camera);
ns.publish("NewStream1", "live");
}
}
当我运行此文件时,我在 label10 中看到“已连接”,这意味着它已连接到 rtmp 服务器链接。
当我在 Adobe 默认页面中插入这个特定的 rtmp 链接和 NewStream1 (来自 ns.publish("NewStream1", "live"); )时,它不起作用......它连接了,但只显示空白黑框。
当我使用该默认页面进行流媒体播放时,左广播公司,效果很好。
有人可以帮我解决这个问题,告诉我我做错了什么吗?
谢谢。
编辑:
另外,当我移除时会发生奇怪的事情
video.attachCamera(camera);
当相机连接到流光时仍然有线条
ns.attachCamera(camera);
但是相机上有灯,这表明相机处于活动状态,它打开 1-2 秒然后关闭......所以相机后不使用... 所以这可能是 NetStreaming 对象的问题,因为它拒绝摄像头......
I have Adobe Media Server 4, and I am using Flash Professional CS5.5 to create streaming application.
For testing I use default Adobe Page where you can insert streamer url and Stream name to connect to streaming source, for overview.
It's that page at start up, where you have two blocks of videos, left one to broadcast and right one to see stream.
Here is the AS3 code:
var bandwidth:int = 0;
var quality:int = 50;
var camera:Camera = Camera.getCamera();
camera.setQuality(bandwidth, quality);
camera.setMode(430,320,15, true);
var video:Video = new Video();
video.attachCamera(camera);
addChild(video);
video.width = 430;
video.height = 320;
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://***");
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
function netStatusHandler(event:NetStatusEvent):void{
if (event.info.code == "NetConnection.Connect.Success")
{
label10.text = 'Connected';
var ns:NetStream = new NetStream(nc);
ns.attachCamera(camera);
ns.publish("NewStream1", "live");
}
}
When I run this file I get "Connected" in label10, that means it's connected to rtmp server link.
When I insert this specific rtmp link and NewStream1 ( from ns.publish("NewStream1", "live"); ) inside Adobe Default page, it doesn't work... It connects, but it shows only blank black box.
And when I use that default page to stream, left broadcaster, it works great.
Can someone help me with this, tell me what I am doing wrong?
Thank you.
EDIT:
Also, strange thing happen when I remove
video.attachCamera(camera);
There is still line when camera is attached to streamer
ns.attachCamera(camera);
But light on camera, that is signing that camera is active, it turn on for 1-2 seconds and it turn off... So camera is not used after...
So it might be a problem with NetStreaming object, since it's rejecting camera...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是它
需要在函数定义之外...因为这样它是函数变量并且在函数结束后被“杀死”...
Problem was that
needs to be outside function defined... Since this way it's function variable and it's "killed" after function ends...