[Red5] FlvPlayback

Eric Pincus Eric at BobGail.com
Tue Jul 4 05:57:05 EDT 2006


Hassan,

 

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 {

 

 

I look forward to your response

 

Eric

 

________________________________

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 :-) 

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5_osflash.org/attachments/20060704/9febb21c/attachment-0001.htm


More information about the Red5 mailing list