rtmp поток и передача параметров в php скрипт
October 17, 2016 03:41AM
Необходимо реализовать авторизацию для rtmp потока, путем передачи потоку
параметров: пользователь и его пароль.
Просматриваю поток с помощью vlc. Строка подключения к потоку такая:
rtmp://x.x.x.x/live2?user=alex&pass=12

Для этих целей была установлена связка: nginx, с скомпилированным rtmp
модулем и php-fpm.
php скрипты отрабатывают.
Настройки nginx.conf:

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}


rtmp {
server {
listen 1935;
chunk_size 4096;

application live2 {
live on;
meta copy;
exec_options on;
record off;
on_publish http://x.x.x.x/auth1.php;
notify_method get;
allow publish all;
allow play all;
}

}

Проблема состоит в том, что не передаются параметры в скрипт auth1.php.
Если явно указываю параметры on_publish
http://x.x.x.x/auth1.php?user=alex&pass=12&;
то скрипт auth1.php отрабатывает как нужно и поток могу просматривать.

В логах получаю:

2016/10/16 14:44:10 [info] 10906#0: *1 connect: app='live2'
args='user=alex&pass=12' flashver='LNX 9,0,124,2' swf_url=''
tc_url='rtmp://x.x.x.x:1935/live2?user=alex&pass=12' page_url=''
acodecs=4071 vcodecs=252 object_encoding=0, client: y.y.y.y, server:
0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: *1 createStream, client: y.y.y.y,
server: 0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: *1 play: name='' args='' start=-2000
duration=0 reset=0 silent=0, client: y.y.y.y, server: 0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: exec: starting managed child 'ffmpeg'
2016/10/16 14:44:10 [info] 10906#0: *2 client connected 'x.x.x.x'
2016/10/16 14:44:10 [info] 10906#0: *2 connect: app='live2' args=''
flashver='' swf_url='' tc_url='rtmp://x.x.x.x:1935/live2' page_url=''
acodecs=0 vcodecs=0 object_encoding=0, client: x.x.x.x, server: 0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: *2 createStream, client: x.x.x.x,
server: 0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: *2 publish: name='' args='' type=live
silent=0, client: x.x.x.x, server: 0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: *2 notify: publish 'x.x.x.x/auth1.php',
client: x.x.x.x, server: 0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: *2 disconnect, client: x.x.x.x, server:
0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: *2 deleteStream, client: x.x.x.x,
server: 0.0.0.0:1935
2016/10/16 14:44:10 [info] 10906#0: exec: child 10907 exited; ignoring
2016/10/16 14:44:10 [info] 10906#0: exec: terminating child 10907
2016/10/16 14:44:10 [notice] 10906#0: signal 17 (SIGCHLD) received
2016/10/16 14:44:10 [notice] 10906#0: signal 17 (SIGCHLD) received
2016/10/16 14:44:10 [notice] 10906#0: unknown process 10907 exited with
code 1
2016/10/16 14:44:10 [notice] 10906#0: unknown process 10907 exited with
code 1
2016/10/16 14:44:10 [info] 10906#0: epoll_wait() failed (4: Interrupted
system call)
2016/10/16 14:44:15 [info] 10906#0: exec: starting managed child 'ffmpeg'
2016/10/16 14:44:16 [info] 10906#0: *6 client connected 'x.x.x.x'
2016/10/16 14:44:16 [info] 10906#0: *6 connect: app='live2' args=''
flashver='' swf_url='' tc_url='rtmp://x.x.x.x:1935/live2' page_url=''
acodecs=0 vcodecs=0 object_encoding=0, client: x.x.x.x, server: 0.0.0.0:1935
2016/10/16 14:44:16 [info] 10906#0: *6 createStream, client: x.x.x.x,
server: 0.0.0.0:1935
2016/10/16 14:44:16 [info] 10906#0: *6 publish: name='' args='' type=live
silent=0, client: x.x.x.x, server: 0.0.0.0:1935
2016/10/16 14:44:16 [info] 10906#0: *6 notify: publish 'x.x.x.x/auth1.php',
client: x.x.x.x, server: 0.0.0.0:1935
2016/10/16 14:44:16 [info] 10906#0: *6 disconnect, client: x.x.x.x, server:
0.0.0.0:1935
2016/10/16 14:44:16 [info] 10906#0: *6 deleteStream, client: x.x.x.x,
server: 0.0.0.0:1935
2016/10/16 14:44:16 [info] 10906#0: exec: child 10908 exited; ignoring
2016/10/16 14:44:16 [info] 10906#0: exec: terminating child 10908
2016/10/16 14:44:16 [notice] 10906#0: signal 17 (SIGCHLD) received
2016/10/16 14:44:16 [notice] 10906#0: signal 17 (SIGCHLD) received
2016/10/16 14:44:16 [notice] 10906#0: unknown process 10908 exited with
code 1
2016/10/16 14:44:16 [notice] 10906#0: unknown process 10908 exited with
code 1
2016/10/16 14:44:16 [info] 10906#0: epoll_wait() failed (4: Interrupted
system call)

Что еще нужно подправить, что бы можно было бы передавать параметры в php
скрипт.

Спасибо!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 155
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready