PDA

View Full Version : create custom flv player


mallen
04-19-2008, 11:06 PM
I am trying to create my own custom video player. I have a working version that passes the flv file name in the URL using swfobject. Works fine with the standard FLVplayback component.

But now I am trying to combine this code with my custom FLV player. Can't seem to get it right. I know I have to get the string to connect to the NetStream. Or get my_FLVPlybk.contentPath = "../video/"+video; into a variable.


var video:String = flv;
var caption:String = flv;

my_FLVPlybk.contentPath = "../video/"+video;



var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns :NetStream = new NetStream(nc);
my_FLVPlybk.attachVideo(ns);
my_FLVPlybk.play();
mcPause.onPress = function() {
ns.pause (true);
}

mcPlay.onPress = function() {
ns.pause(false);
}
playMovie();

atomic
04-20-2008, 12:31 AM
Can you attach a .fla & relevant files?

mallen
04-20-2008, 01:07 AM
Thanks Atomic for your help. I sent you a PM. :D

atomic
04-20-2008, 07:56 PM
//var video:String = flv;
//var caption:String = flv;
var Path:String = "video/roy2.flv";
//my_FLVPlybk.contentPath = "../video/"+video;

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
my_FLVPlybk.attachVideo(ns);
/*function playMovie():Void {
my_FLVPlybk.play(Path);
}*/

mcPause.onPress = function() {
ns.pause(true);
};
mcPlay.onPress = function() {
ns.pause(false);
};
ns.play(Path);

mallen
04-21-2008, 12:57 AM
Atomic, Thanks again for your help. This part seems like it is not working because I am sending the file via the swfobject and not just playing one specific flv file.

var Path:String = "video/roy2.flv";
//my_FLVPlybk.contentPath = "../video/"+video;

If my video resides in the video folder it depends on what link I click in my HTML page.

mallen
04-22-2008, 02:53 AM
I got it working. Thanks Atomic for your help. :D

var video:String = flv;
var Path:String = "../video/"+video;
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
my_FLVPlybk.attachVideo(ns);


mcPause.onPress = function() {
ns.pause(true);
};
mcPlay.onPress = function() {
ns.pause(false);
};
ns.play(Path);