Open terry8204 opened 6 months ago
Could you please post the logs from SRS? When SRS triggers the on_play
and on_stop
callbacks, it generates logs with timestamp information.
TRANS_BY_GPT4
[2023-12-30 15:06:01.718][INFO][30378][6081177o] http: on_play ok, client_id=6081177o, url=http://127.0.0.1/userwebservlet?action=srshookcallback, request={"server_id":"vid-2081113","service_id":"9iv27566","action":"on_play","client_id":"6081177o","ip":"211.72.34.7","vhost":"__defaultVhost__","app":"live","stream":"53810829311_1_0_1078_video","tcUrl":"rtmp://__defaultVhost__/live","param":"","pageUrl":"https://gps51.com/","stream_url":"/live/53810829311_1_0_1078_video","stream_id":"vid-8kyv194"}, response={"code":0}
[2023-12-30 15:06:01.718][INFO][30378][6081177o] FLV /live/53810829311_1_0_1078_video.flv, encoder=FLV, mw_sleep=100ms, cache=0, msgs=128, dinm=1, guess_av=0/1/1
[2023-12-30 15:06:01.827][INFO][30378][2w010367] http: on_stop ok, client_id=2w010367, url=http://127.0.0.1/userwebservlet?action=srshookcallback, request={"server_id":"vid-2081113","service_id":"9iv27566","action":"on_stop","client_id":"2w010367","ip":"211.72.34.7","vhost":"__defaultVhost__","app":"live","tcUrl":"rtmp://__defaultVhost__/live","stream":"53810829311_1_0_1078_video","param":"","stream_url":"/live/53810829311_1_0_1078_video","stream_id":"vid-8kyv194"}, response={"code":0}
[2023-12-30 15:06:01.909][INFO][30378][759vl211] HTTP #0 127.0.0.1:41838 GET http://rtmpbackend/live/53810829311_1_0_1078_video.flv, content-length=-1
[2023-12-30 15:06:01.911][INFO][30378][759vl211] http: on_play ok, client_id=759vl211, url=http://127.0.0.1/userwebservlet?action=srshookcallback, request={"server_id":"vid-2081113","service_id":"9iv27566","action":"on_play","client_id":"759vl211","ip":"211.72.34.7","vhost":"__defaultVhost__","app":"live","stream":"53810829311_1_0_1078_video","tcUrl":"rtmp://__defaultVhost__/live","param":"","pageUrl":"https://gps51.com/","stream_url":"/live/53810829311_1_0_1078_video","stream_id":"vid-8kyv194"}, response={"code":0}
[2023-12-30 15:06:01.912][INFO][30378][759vl211] FLV /live/53810829311_1_0_1078_video.flv, encoder=FLV, mw_sleep=100ms, cache=0, msgs=128, dinm=1, guess_av=0/1/1
[2023-12-30 15:06:01.920][INFO][30378][6081177o] http: on_stop ok, client_id=6081177o, url=http://127.0.0.1/userwebservlet?action=srshookcallback, request={"server_id":"vid-2081113","service_id":"9iv27566","action":"on_stop","client_id":"6081177o","ip":"211.72.34.7","vhost":"__defaultVhost__","app":"live","tcUrl":"rtmp://__defaultVhost__/live","stream":"53810829311_1_0_1078_video","param":"","stream_url":"/live/53810829311_1_0_1078_video","stream_id":"vid-8kyv194"}, response={"code":0}
TRANS_BY_GPT4
This issue is indeed quite peculiar. I will take some time to look into it next week. Thank you for the feedback.
TRANS_BY_GPT4
Run SRS 5.0:
./objs/srs -c conf/http.hooks.callback.conf
Run callback server:
go run research/api-server/server.go
Publish stream to SRS:
ffmpeg -re -i ~/srs/doc/source.flv -c copy -f flv rtmp://localhost/live/livestream
Use ffmpeg as player to pull stream, which should trigger on_play
and on_stop
:
ffmpeg -i rtmp://localhost/live/livestream
The events is on_play
then on_stop
:
2024/01/09 15:03:09.112678 server.go:689: Got action=on_play, client_id=08g9611r, ip=127.0.0.1, vhost=__defaultVhost__, stream=livestream, param=, pageUrl=
2024/01/09 15:03:09.461312 server.go:689: Got action=on_stop, client_id=08g9611r, ip=127.0.0.1, vhost=__defaultVhost__, stream=livestream, param=
I can not reproduce this issue.
What's your SRS version?
version: V6.0_d3 The first playback occurs without issues. During the second operation, the first playback is terminated while initiating a new playback session.
TRANS_BY_GPT4
Describe the bug Monitor whether the user has closed the browser using the HTTP hook API, and then automatically disconnect the device's stream. Each time the playback is clicked to restart, the 'on_play' event is received first, followed by the 'on_stop' event.
Configuration file:
Version V6.0_d3
To Reproduce Steps to reproduce the behavior:
Expected behavior First, an 'on_stop' event is received, followed by an 'on_play' event.
Screenshots
Additional context
TRANS_BY_GPT4