[Red5] FlvPlayback
JesterXL
jesterxl at jessewarden.com
Tue Jul 4 10:06:58 EDT 2006
Can't you get the total playtime of your movie via the length property via the NetStream's onMetaData?
----- Original Message -----
From: Hassan Beigi
To: Red5 at osflash.org
Sent: Tuesday, July 04, 2006 9:08 AM
Subject: Re: [Red5] FlvPlayback
Hi Eric,
I'm curious - this workaround - is it to:
1) make the FlvPlayback component compatible with flv and red5
or
2) fix my pausing error with the video component.
Also - the server doesn't like me adding the argument type:String to the getStreamName function.
public function getStreamName(type:String):String {
The code gives you only an idea how to make the netStream.play method compatible with red5.
I don´t know how to test this component with ServerStreaming and don't know this component in detail.
It is easier to make your own component.
The best way to fix FLVPlayback is to rewrite the _play method in VideoPlayer.as
In _play method, you can make the code compatible with .flv and red5
FLVPlayback also expects that you know the total playtime of your movies and this parameter is only available with serverside code.
In the method _pause, you can fix the pausing error.
--------------------------------------------------------------------------------
From: Red5-bounces at osflash.org [mailto:Red5-bounces at osflash.org] On Behalf Of Hassan Beigi
Sent: Sunday, July 02, 2006 10:46 AM
To: Red5 at osflash.org
Subject: Re: [Red5] FlvPlayback
Hi Eric,
i am not familiar with this component.
Here are 3 steps to fix the problem: The modifications are very dirty and untested. It gives you only an idea how to fix it. I have changed the lines commented with //NEW .
1)
Find the Flash 8 Classes on your machine:
Here is the german path to the file:
C:\Dokumente und Einstellungen\[User]\Lokale Einstellungen\Anwendungsdaten\Macromedia\Flash 8\en\Configuration\Classes\mx\video
english path must be something like that:
C:\Documents and Settings\[User]\Local Settings\Applicationdata\ Macromedia\Flash 8\en\Configuration\Classes\mx\video
Or search for the file (VideoPlayer.as and NCManager.as) on your machine.
2) Open VideoPlayer.as
replace the following method:
private function _play():Void {
//ifdef DEBUG
//var debugString:String = "_play("
//if (arguments.length > 0) {
// debugString += arguments[0];
// if (arguments.length > 1) {
// debugString += ", " + arguments[1];
// }
//}
//debugString += ")";
//debugTrace(debugString);
//debugTrace("_ncMgr.getStreamName() = " + _ncMgr.getStreamName());
//endif
_startingPlay = true;
switch (arguments.length) {
case 0:
_ns.play(_ncMgr.getStreamName("flv"), (_isLive) ? -1 : 0, -1); //NEW CODE - "flv" string as parameter
break;
case 1:
_ns.play(_ncMgr.getStreamName("flv"), (_isLive) ? -1 : arguments[0], -1); //NEW CODE - "flv" string as parameter
break;
case 2:
_ns.play(_ncMgr.getStreamName("flv"), (_isLive) ? -1 : arguments[0], arguments[1]); //NEW CODE - "flv" string as parameter
break;
default:
throw new Error("bad args to _play");
}
}
3) Open NCManager.as
add the following variable:
private var _isMMServer:Boolean; //NEW CODE
repace the constructor:
public function NCManager() {
initNCInfo();
initOtherInfo();
//HB: VERY DIRTY CODE
_isMMServer = _level0.isMMServer; //NEW DIRTY CODE
// intervals
_timeoutIntervalId = 0;
_tryNCIntervalId = 0;
// actually calls setter
_timeout = DEFAULT_TIMEOUT;
}
Replace the following method:
public function getStreamName(type:String):String {
if (type==undefined || _isMMServer) return _streamName; else return _streamName+"."+type; //NEW CODE
}
I hope it helps.
Bye,
Hassan Beigi
--------------------------------------------------------------------------------
Von: Red5-bounces at osflash.org [mailto:Red5-bounces at osflash.org] Im Auftrag von Eric Pincus
Gesendet: Sonntag, 2. Juli 2006 19:01
An: Red5 at osflash.org
Betreff: Re: [Red5] FlvPlayback
Thanks - I'll try that as a workaround - but it's really a workaround for what I'm already using as a workaround.
What my main question is - which I've yet to get any word in is.
Can I how can use the FlvPlayback control to connect to an FLV hosted by Red5?
The workaround is to use the video object - but do I need to use a workaround at all - I'd rather just use the FlvPlayback control.
--------------------------------------------------------------------------------
From: Red5-bounces at osflash.org [mailto:Red5-bounces at osflash.org] On Behalf Of Hassan Beigi
Sent: Sunday, July 02, 2006 6:21 AM
To: Red5 at osflash.org
Subject: Re: [Red5] FlvPlayback
Hi Eric,
Try this very ugly code as workaround J
paused = false;
function Pause (eventOj:Object){
if (!paused) {
onEnterFrame = function () {
my_ns.seek (my_ns.time);
}
} else {
delete onEnterFrame;
}
paused = !paused;
}
--------------------------------------------------------------------------------
Von: Red5-bounces at osflash.org [mailto:Red5-bounces at osflash.org] Im Auftrag von Eric Pincus
Gesendet: Sonntag, 2. Juli 2006 14:31
An: Red5 at osflash.org
Betreff: Re: [Red5] FlvPlayback
Thank you - but I'm not sure how that applies.
The following code is working with the video object - but pause functionality is awkward - restarting 5-10 seconds earlier than where I pause it
var my_nc:NetConnection = new NetConnection();
my_nc.connect("rtmp://localhost/oflaDemo");
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
my_ns.setBufferTime(1);
my_ns.play("downtown.flv");
btnPause.addEventListener("click", Pause);
function Pause(eventOj:Object)
{
my_ns.pause();
}
This is without the FlvPlayback control - with the video object and a single button labeled btnPause.
I would PREFER to just just the FlvPlayback control using a skin so I don't have to code for the various functions (play, pause, mute, volv)
Simply setting the contentPath of a FlvPlayback control to "rtmp:://localhost/oflaDemo/downtown.flv" fails.
If I still need to use a NetStream object with the FlvPlayback control - how do I wire the two together?
Thanks
--------------------------------------------------------------------------------
From: Red5-bounces at osflash.org [mailto:Red5-bounces at osflash.org] On Behalf Of Hassan Beigi
Sent: Sunday, July 02, 2006 2:50 AM
To: Red5 at osflash.org
Subject: Re: [Red5] FlvPlayback
Hi Eric,
red5 needs the .flv extension for the NetStream.play Method:
FlashCom / MediaServer : stream.play ("filename",.)
Red5: stream.play ("filename.flv",.)
bye
--------------------------------------------------------------------------------
Von: Red5-bounces at osflash.org [mailto:Red5-bounces at osflash.org] Im Auftrag von Eric Pincus
Gesendet: Sonntag, 2. Juli 2006 11:08
An: Red5 at osflash.org
Betreff: [Red5] FlvPlayback
Hey all,
So what is the verdict on the FlvPlayback object within flash?
I can't get it to work with Red5. I've seen a dozen questions on this very subject around the net - but never an answer.
I know that with FMS - you need to have the main.asc file copied to the application directory - that you need to have your media in the streams\_definst_ directory, etc.
It works from FMS - but nothing from Red5.
All I'm trying to do is set up a simple flv streaming with FlvPlackback.
I've tried to set it up with a simple video object but when I use the pause function - and then restart - the video drops back about 5-10 seconds.
Help if you can,
Eric
--------------------------------------------------------------------------------
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5_osflash.org/attachments/20060704/77e09e20/attachment-0001.htm
More information about the Red5
mailing list