More resource may check here:
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/media/Video.html
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/NetConnection.html
AS3 Simple:
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
public class main extends MovieClip {
private var nc:NetConnection;
private var ns:NetStream;
private var vid:Video;
private var client:Object;
public function main () {
// Initialize net stream
nc = new NetConnection();
nc.connect (null); // Not using a media server.
ns = new NetStream(nc);
// Add video to stage
vid = new Video(320,240);
addChild (vid);
//vid.x = ( stage.stageWidth / 2) - ( vid.width / 2 );
//vid.y = ( stage.stageHeight / 2) - ( vid.height / 2 );
// Changed since when deployed the
// above set the video player nearly off the screen
// Since I am lazy, I am just going to 0 them
// out for now. Apparently, I have a lot more
// to learn.
vid.x = 0;
vid.y = 0;
// Add callback method for listening on
// NetStream meta data
client = new Object();
ns.client = client;
client.onMetaData = nsMetaDataCallback;
// Play video
vid.attachNetStream ( ns );
ns.play ( 'test FLV.flv' );
}
//MetaData
private function nsMetaDataCallback (mdata:Object):void {
trace (mdata.duration);
}
}
}
Check if video is finish
================
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/media/Video.html
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/NetConnection.html
AS3 Simple:
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
public class main extends MovieClip {
private var nc:NetConnection;
private var ns:NetStream;
private var vid:Video;
private var client:Object;
public function main () {
// Initialize net stream
nc = new NetConnection();
nc.connect (null); // Not using a media server.
ns = new NetStream(nc);
// Add video to stage
vid = new Video(320,240);
addChild (vid);
//vid.x = ( stage.stageWidth / 2) - ( vid.width / 2 );
//vid.y = ( stage.stageHeight / 2) - ( vid.height / 2 );
// Changed since when deployed the
// above set the video player nearly off the screen
// Since I am lazy, I am just going to 0 them
// out for now. Apparently, I have a lot more
// to learn.
vid.x = 0;
vid.y = 0;
// Add callback method for listening on
// NetStream meta data
client = new Object();
ns.client = client;
client.onMetaData = nsMetaDataCallback;
// Play video
vid.attachNetStream ( ns );
ns.play ( 'test FLV.flv' );
}
//MetaData
private function nsMetaDataCallback (mdata:Object):void {
trace (mdata.duration);
}
}
}
Check if video is finish
================