转载:http://blog.youkuaiyun.com/lxh2808/article/details/6002603
package
{
//flash imports
import flash.display.Sprite;
//osmf imports
import org.osmf.containers.MediaContainer;
import org.osmf.elements.VideoElement;
import org.osmf.media.MediaPlayer;
import org.osmf.media.URLResource;
import org.osmf.net.httpstreaming.HTTPStreamingNetLoader;
public class test extends Sprite
{
private const MEDIA_URL : String = "http://192.168.10.36:8080/video/FlashRuntimes.mp4" ;
public function test()
{
// Create the container class that displays the media.
var container:MediaContainer = new MediaContainer();
//add the MediaContainer instance to the stage
addChild(container);
// Create the resource to play and point it to the FLV
var resource:URLResource = new URLResource( MEDIA_URL );
// Create the MediaElement
var videoElement:VideoElement = new VideoElement( resource , new HTTPStreamingNetLoader ( ) );
//add the VideoElement to our container class
container.addMediaElement(videoElement);
//create the MediaPlayer instance
var mediaPlayer:MediaPlayer = new MediaPlayer();
// Set the MediaElement on a MediaPlayer.
//Because autoPlay defaults to true, playback begins immediately
mediaPlayer.media = videoElement;
}
}
}
本文介绍了一个使用ActionScript 3.0 (AS3) 和 Open Source Media Framework (OSMF) 实现的简单视频播放器示例。该播放器通过加载特定URL的视频文件实现在线播放功能。示例中创建了MediaContainer实例用于显示媒体,并通过URLResource指定要播放的视频资源位置。
5011

被折叠的 条评论
为什么被折叠?



