Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using FLV streaming, the on_play function of http_hooks returns the parameters of the stream being pushed (IP and param). #1210

Closed
kirbyliu opened this issue Aug 28, 2018 · 8 comments
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@kirbyliu
Copy link

kirbyliu commented Aug 28, 2018

When using three different devices for push-pull stream authentication.
The push device uses rtmp. {"action":"on_publish","client_id":290,"ip":"10.0.0.100","vhost":"defaultVhost","app":"live","stream":"a688354e3a62daf45099a0d7cb144bed","param":"?s=005477ec00579a5711fb033dfa7b4784&t=1535481066&u=5","pageUrl":""}

The other two devices use rtmp and flv respectively.

The device that uses rtmp for streaming has the on_play parameter set correctly without any errors.
{"action":"on_play","client_id":307,"ip":"10.0.0.101","vhost":"defaultVhost","app":"5","stream":"a688354e3a62daf45099a0d7cb144bed","param":"?s=88a9c91c1af18da7a3753f18f941e542&t=1535481119&u=4","pageUrl":""}

For devices that use flv for streaming, the on_play callback includes the param and ip information of the streaming device.
{"action":"on_play","client_id":315,"ip":"10.0.0.100","vhost":"defaultVhost","app":"5","stream":"a688354e3a62daf45099a0d7cb144bed","param":"?s=005477ec00579a5711fb033dfa7b4784&t=1535481066&u=5","pageUrl":""}

TRANS_BY_GPT3

@kirbyliu
Copy link
Author

kirbyliu commented Aug 28, 2018

The version being used is SRS v2.0.255.

TRANS_BY_GPT3

@whSwitching
Copy link

whSwitching commented Sep 18, 2018

same problem here ...

play rtmp://192.168.2.10:1935/rooms/cam1?token=clientTOKEN

[2018-09-18 13:04:30][trace] post to sessions, req={"action":"on_play","client_id":227,"ip":"192.168.2.2","vhost":"defaultVhost","app":"rooms","stream":"cam1","param":"?token=clientTOKEN","pageUrl":"http://www.ossrs.net/srs.release/trunk/research/players/srs_player.html?server=192.168.1.170&vhost=192.168.1.170#"}

play https://192.168.2.10/rooms/cam1.flv?token=clientTOKEN

[2018-09-18 13:04:56][trace] post to sessions, req={"action":"on_play","client_id":230,"ip":"192.168.2.2","vhost":"defaultVhost","app":"rooms","stream":"cam1","param":"?token=publisherTOKEN","pageUrl":""}
[2018-09-18 13:04:56][trace] srs on_play: client id=230, ip=192.168.2.2, vhost=defaultVhost, app=rooms, stream=cam1, pageUrl=
127.0.0.1 - - [18/Sep/2018:13:04:56] "POST /api/v1/sessions HTTP/1.1" 200 1 "" "SRS(Simple RTMP Server)2.0.255"

@whSwitching
Copy link

btw, how can I disable rtmp:// play, allow http-flv play only? port 1935 should not be disabled on the server because publisher could use that

@winlinvip
Copy link
Member

btw, how can I disable rtmp:// play, allow http-flv play only? port 1935 should not be disabled on the server because publisher could use that

Please file another issue.

@winlinvip winlinvip added the Bug It might be a bug. label Oct 7, 2018
@winlinvip winlinvip added this to the srs 2.0 release milestone Oct 7, 2018
@winlinvip
Copy link
Member

winlinvip commented Dec 13, 2019

Configuration:

vhost __defaultVhost__ {
    http_hooks {
        enabled         on;
        on_publish      http://127.0.0.1:8085/api/v1/streams;
        on_play         http://127.0.0.1:8085/api/v1/sessions;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
}

Streaming, with parameter ?token=publish:

ffmpeg -re -i trunk/doc/source.200kbps.768x320.flv -c copy -f flv \
    -y 'rtmp://127.0.0.1/live/livestream?token=publish'

When playing RTMP, the parameter is normal:

ffmpeg -f flv -i 'rtmp://127.0.0.1/live/livestream?role=play' -c copy -f flv -y /dev/null 
[2019-12-13 01:57:26][trace] post to sessions, req={"action":"on_play","client_id":292,"ip":"172.17.0.2","vhost":"__defaultVhost__",
"app":"live","stream":"livestream","param":"?role=play","pageUrl":""}

When playing FLV, the parameters are also normal:

curl 'http://127.0.0.1:8080/live/livestream.flv?role=flv' -o /dev/null -v
[2019-12-13 02:02:50][trace] srs on_play: client id=575, ip=, vhost=__defaultVhost__, app=live, stream=livestream, 
param=?role=flv, pageUrl=
127.0.0.1 - - [13/Dec/2019:02:02:50] "POST /api/v1/sessions HTTP/1.1" 200 25 "" "SRS/3.0.71(OuXuli)"

SRS3 is normal, let me check SRS2.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 13, 2019

SRS2 is also normal:

[2019-12-13 02:40:47][trace] post to sessions, req={"action":"on_play","client_id":115,"ip":"","vhost":"__defaultVhost__","app":"live",
"stream":"livestream","param":"?role=flv","pageUrl":""}
[2019-12-13 02:40:47][trace] srs on_play: client id=115, ip=, vhost=__defaultVhost__, app=live, stream=livestream, pageUrl=
127.0.0.1 - - [13/Dec/2019:02:40:47] "POST /api/v1/sessions HTTP/1.1" 200 1 "" "SRS(Simple RTMP Server)2.0.265"

Please confirm if your reproduction steps can consistently reproduce the issue.

TRANS_BY_GPT3

@kirbyliu
Copy link
Author

kirbyliu commented Dec 25, 2019

That param was fixed in 2.0-r6. Now the issue is that the IP cannot be obtained.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

Dup to #1488

@winlinvip winlinvip self-assigned this Sep 11, 2021
@winlinvip winlinvip changed the title 使用FLV拉流时http_hooks的on_play返回的是推流的参数(ip和param) When using FLV streaming, the on_play function of http_hooks returns the parameters of the stream being pushed (IP and param). Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

3 participants