Flash Media Server 视频流如何放到网页上播放?
我装了FlashMediaServer和FlashMediaEncoder,我想在自己的网页上观看到视频流,我该如何在网页上操作?FlashMediaEncoder会生成...
我装了Flash Media Server 和 Flash Media Encoder,我想在自己的网页上观看到视频流,我该如何在网页上操作?
Flash Media Encoder会生成一个类似这样的地址:rtmp://网址:80/live/123,如何能把视频窗口放到网页上观看。
是要通过 flash CS professional 制作一个SWF文件吗?
请高手指教,我是菜鸟一只。
谢谢了 展开
Flash Media Encoder会生成一个类似这样的地址:rtmp://网址:80/live/123,如何能把视频窗口放到网页上观看。
是要通过 flash CS professional 制作一个SWF文件吗?
请高手指教,我是菜鸟一只。
谢谢了 展开
1个回答
展开全部
package book{
import flash.display.Sprite;
import flash.events.*;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
public class VideoExample extends Sprite {
private var videoURL:String = "test.flv";//这里就是你的flv地址。
private var connection:NetConnection;
private var stream:NetStream;
public function VideoExample() {
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.connect(null);
}
private function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
case "NetConnection.Connect.Success" :
trace("success!!!");
connectStream();
break;
case "NetStream.Play.StreamNotFound" :
trace("Unable to locate video: " + videoURL);
break;
}
}
private function connectStream():void {
stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
var video:Video = new Video(550,400);
video.attachNetStream(stream);
video.name = "video"
video.addEventListener(Event.ENTER_FRAME,enterFrameHandler);
stream.play(videoURL);
addChild(video);
}
private function enterFrameHandler(event:Event):void
{
trace(event.target.name);
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}
private function asyncErrorHandler(event:AsyncErrorEvent):void {
// ignore AsyncErrorEvent events.
}
}
}
帧上
import book.VideoExample;
addChild(new VideoExample());
上面的东西,是很久前做测试写的一个类。就是播放一个外部的视频流吧。你可以用上面的东西做成一个swf,然后再放到网页上面去。
import flash.display.Sprite;
import flash.events.*;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
public class VideoExample extends Sprite {
private var videoURL:String = "test.flv";//这里就是你的flv地址。
private var connection:NetConnection;
private var stream:NetStream;
public function VideoExample() {
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.connect(null);
}
private function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
case "NetConnection.Connect.Success" :
trace("success!!!");
connectStream();
break;
case "NetStream.Play.StreamNotFound" :
trace("Unable to locate video: " + videoURL);
break;
}
}
private function connectStream():void {
stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
var video:Video = new Video(550,400);
video.attachNetStream(stream);
video.name = "video"
video.addEventListener(Event.ENTER_FRAME,enterFrameHandler);
stream.play(videoURL);
addChild(video);
}
private function enterFrameHandler(event:Event):void
{
trace(event.target.name);
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}
private function asyncErrorHandler(event:AsyncErrorEvent):void {
// ignore AsyncErrorEvent events.
}
}
}
帧上
import book.VideoExample;
addChild(new VideoExample());
上面的东西,是很久前做测试写的一个类。就是播放一个外部的视频流吧。你可以用上面的东西做成一个swf,然后再放到网页上面去。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询