股墓山庄

专注于AS3,JavaScript 每天一点进步,坚持...
  博客园  :: 首页  :: 新随笔  :: 联系 :: 管理

FLVPlayback应用

Posted on 2012-06-07 00:30  股墓山庄庄主  阅读(2318)  评论(0编辑  收藏  举报
// ActionScript 3.0
/* Requires
 * - FLVPlayback control in Flash library
 */
import fl.video.FLVPlayback;
import fl.video.MetadataEvent;
import fl.video.*;
 
var flvPlayback:FLVPlayback = new FLVPlayback();
flvPlayback.autoPlay = false;
flvPlayback.addEventListener(MetadataEvent.METADATA_RECEIVED, flvPlayback_metadataReceived);
flvPlayback.addEventListener(VideoEvent.READY, flvPlayback_ready);
flvPlayback.addEventListener(MetadataEvent.CUE_POINT, flvPlayback_cuePoint);
flvPlayback.source = "http://www.helpexamples.com/flash/video/cuepoints.flv";
flvPlayback.skin = "SkinOverPlaySeekMute.swf";
flvPlayback.x = 10;
flvPlayback.y = 10;
addChild(flvPlayback);
 
function flvPlayback_metadataReceived(evt:MetadataEvent):void {
    trace("duration:", evt.info.duration); // 16.334
    trace("framerate:", evt.info.framerate); // 15
    trace("width:", evt.info.width); // 320
    trace("height:", evt.info.height); // 213
}
function flvPlayback_ready(evt:VideoEvent):void {
    flvPlayback.addASCuePoint(1, "cuePoint1");
}
 
function flvPlayback_cuePoint(evt:MetadataEvent):void {
    trace("CUE POINT!!!");
    trace("\t", "name:", evt.info.name); // name: cuePoint1
    trace("\t", "time:", evt.info.time); // time: 1
    trace("\t", "type:", evt.info.type); // type: actionscript
}