alaabataineh / php-rtmp-client

Automatically exported from code.google.com/p/php-rtmp-client
1 stars 0 forks source link

Tested against rtmpd #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I'm Andrei (owner of rtmpd.com). Tested you work against rtmpd. It almost 
works. Some issues:

1. I needed to deactivate handshake validation in order to allow the client 
connection. This means that the RTMP handshake is not properly made. Don't have 
too 
much experience with php language, but I can offer support if you want to 
implement it. Moreover, once correctly implemented you will automatically get 
access 
to RTMPE :)

2. The (de)serializer for date/time/datetime is not working. Attached you have 
the response

Anyway, great job! My first target language in implementing edge-origin is php. 
So I'm directly interested in finding a good library for php RTMP stuff.

Cheers,
Andrei

Original issue reported on code.google.com by crtmpser...@gmail.com on 11 Jan 2010 at 2:50

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Andrei!

Thanks for your feedback!

My handshake work fine with 2 different rtmp servers... do you have more 
details about the handshake error(wireshark 
dump...) ? Could you determine where exactly the handshake is failing?

I'm very interested by RTMPE ;p

The problem with the date is not a bug, you must set the timezone with this 
method 
"date_default_timezone_set('Europe/Paris');" 
more information: 
http://fr.php.net/manual/en/function.date-default-timezone-set.php

Original comment by qwantix@gmail.com on 11 Jan 2010 at 3:45

GoogleCodeExporter commented 8 years ago
About the handshake error. The trunk from red5 also has a problem with it.

Getting this error:
2010-04-23 13:38:03,127 [NioProcessor-1] ERROR 
o.r.server.net.rtmp.RTMPHandshake -
Unable to validate client

Earlier versions seem to work fine (red5 0.8). This is red5 > 0.9.1 . Maybe 
this can
help?

The code wich gives the error is visisble here:
http://code.google.com/p/red5/source/browse/java/server/trunk/src/org/red5/serve
r/net/rtmp/RTMPHandshake.java

Original comment by niek%sou...@gtempaccount.com on 23 Apr 2010 at 11:42

GoogleCodeExporter commented 8 years ago
As i was impatient i thought to look at it myself. I found 2 problems

In RtmpClient.class.php line 160:
    if(sizeof($this->operations) == 0)

I removed this line. Now i can do calls to fms and new red5 servers without a 
problem
:). Ofcourse, i'm curious what that line does. The $this->operations variable 
seems
being filled at various places though there isn't a place were it gets emptied 
in a loop?

The second problem with the handshake. I adjusted line 392 of 
RtmpClient.class.php
to $stream->write("\x00\x00\x00\x00"); . This got rid of my RTMPHandshake 
error. 
Seeing your comments you weren't completly sure about this?

Anyway, i hoped i helped some.

Original comment by niek%sou...@gtempaccount.com on 23 Apr 2010 at 12:35

GoogleCodeExporter commented 8 years ago
Hello all

i was getting php socket timeout error while connecting to FMS 3.5 although my 
connection was successful with FMS as i checked in admin console.
then i saw suggesstion 
comment  RtmpClient.class.php line 160:
    if(sizeof($this->operations) == 0)

and
Adjust line 392 of RtmpClient.class.php
to $stream->write("\x00\x00\x00\x00");

Now my php socket timeout is resolved and i am getting NULL in php rtmp client.
i am sending a string to FMS and reciving it sucessfully.FMS is sending back 
this string to PHP RTMP client,but i am reciving NULL.

Lot of people have same problem any remedy?
have any body checked it with RED5.

?????
Thanks

Original comment by MrsTayya...@gmail.com on 6 Jul 2010 at 10:18

GoogleCodeExporter commented 8 years ago
Thanks niek - the comment did help and now it's responding correctly. Thank you 
so much.

Original comment by vivek.ka...@gmail.com on 27 Oct 2010 at 4:29

GoogleCodeExporter commented 8 years ago
Hello!
I also tried to use php-rtmp-client with C++ RTMP Server and got this error:

Fatal error: Uncaught exception 'Exception' with message 'Packet
version 0 not supported' in /var/www-dev/rtmp-php/
RtmpClient.class.php: 405

Stack trace:
#0 /var/www-dev/rtmp-php/RtmpClient.class.php(59): RTMPClient->handshake()
#1 /var/www-dev/rtmp-php/main.php(6): 
RTMPClient->connect('localhost','flvplayback')
#2 {main}
  thrown in /var/www-dev/rtmp-php/RtmpClient.class.php on line 405 

The tried the changes specified above and also, I get NULL all the time.

The correct handshake process is described here: 
http://www.adobe.com/devnet/rtmp.html

From what I've seen it seems that the handshake process is not correct. 

Hope this info helps. 
Andrei.

Original comment by webdev.a...@gmail.com on 12 Jan 2011 at 4:44

GoogleCodeExporter commented 8 years ago
Sorry I forgot to tell you what I tried to achieve... I'm trying to get the 
number of connected users on the C++ RTMP Server and this is the piece of code 
used:

require "RtmpClient.class.php";
require "debug.php";
$client = new RtmpClient();
$client->connect("192.168.1.201","brvlive");
$result = $client->call("BaseProtocol::GetStackStatus");
var_dump($result); 

This is it.
Andrei.

Original comment by webdev.a...@gmail.com on 12 Jan 2011 at 4:46

GoogleCodeExporter commented 8 years ago
I just tested php-rtmp and it works great :)

Here is how:

1. Since the php-rtmp doesn't implement the proper RTMP handshake, the server 
will drop the connection and you get "Fatal error: Uncaught exception 
'Exception' with message 'Packet version 0 not supported' in.....". To fix 
this, edit the rtmpd config file and put validateHandshake=false

2. To have a working example, edit 
sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp and at line 114 
add this to lines:

Variant _result = GenericMessageFactory::GetInvokeResult(request, parameters);
SendRTMPMessage(pFrom, _result);

Mind you, this is only for testing. You should make your own functions/events 
using ProcessInvokeGeneric

3. Create a php file with the following content:

require "RtmpClient.class.php";

$client = new RtmpClient();
$client->connect("localhost","vod");
$result = $client->getAvailableFlvs();
var_dump($result);
$client->close();

You should see something now. That is actually the array of files available for 
streaming. If is empty, just add a mp4/mp3/flv/etc file in media folder and 
re-run the sample

Have fun

Original comment by crtmpser...@gmail.com on 13 Jan 2011 at 1:26

GoogleCodeExporter commented 8 years ago
Hi,

I just tested php-rtmp and it works great :)

Here is how:

1. Since the php-rtmp doesn't implement the proper RTMP handshake, the server 
will drop the connection and you get "Fatal error: Uncaught exception 
'Exception' with message 'Packet version 0 not supported' in.....". To fix 
this, edit the rtmpd config file and put validateHandshake=false

2. To have a working example, edit 
sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp and at line 114 
add this to lines:

Variant _result = GenericMessageFactory::GetInvokeResult(request, parameters);
SendRTMPMessage(pFrom, _result);

Mind you, this is only for testing. You should make your own functions/events 
using ProcessInvokeGeneric

3. Create a php file with the following content:

require "RtmpClient.class.php";

$client = new RtmpClient();
$client->connect("localhost","vod");
$result = $client->getAvailableFlvs();
var_dump($result);
$client->close();

You should see something now. That is actually the array of files available for 
streaming. If is empty, just add a mp4/mp3/flv/etc file in media folder and 
re-run the sample

Have fun

Original comment by crtmpser...@gmail.com on 13 Jan 2011 at 1:56

GoogleCodeExporter commented 8 years ago
More on the faulty handshake:

Here is a properly made plain (no encryption) handshake:
http://pastebin.com/q8juzbxe

Here is the RTMPE handshake
http://pastebin.com/DAVXrT2A

There are only few differences between a RTMP and a RTMPE handshake. Actually, 
the only diff between them is that RTMPE uses the keys exchanged for 
encryption. They are exchanged for RTMP as well, just that they are not used

Adobe is serving us bullshit on their documentation. There is a heavy 
key-exchange in that handshake. Moreover, php-rtmp will work just fine with FMS 
and other servers because is a client.

I also implemented the server side handshake in my project. And I can tell you 
for sure that if the flash player doesn't see the correct handshake, it will 
simply refuse to playback h264/AAC content. Just silently fails.

Cheers,
Andrei

Original comment by crtmpser...@gmail.com on 13 Jan 2011 at 1:51

GoogleCodeExporter commented 8 years ago

Original comment by qwantix@gmail.com on 21 Jan 2011 at 10:13