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

HLS steam start to work from iOS device inly second time when refresh the page #1536

Closed
1 of 13 tasks
arsyaCRK opened this issue Mar 6, 2023 · 5 comments
Closed
1 of 13 tasks

Comments

@arsyaCRK
Copy link

arsyaCRK commented Mar 6, 2023

Which version are you using?

v0.21.5

Which operating system are you using?

  • Linux amd64 standard
  • Linux amd64 Docker
  • Linux arm64 standard
  • Linux arm64 Docker
  • Linux arm7 standard
  • Linux arm7 Docker
  • Linux arm6 standard
  • Linux arm6 Docker
  • Windows amd64 standard
  • Windows amd64 Docker (WSL backend)
  • macOS amd64 standard
  • macOS amd64 Docker
  • Other (please describe)

Describe the issue

HLS Steam start to work from second time when restart the page or second open HLS player

Describe how to replicate the issue

  1. start the server
  2. publish with api new proxied rtsp source
  3. read with any hls player on ios

Did you attach the server logs?

2023/03/06 17:20:35 DEB [HLS] [conn 10.10.77.1] GET /2048_2/stream.m3u8
2023/03/06 17:20:35 DEB [HLS] [conn 10.10.77.1] [c->s] GET /2048_2/stream.m3u8 HTTP/1.1
Host: 127.0.0.1:8888
Accept: /
Accept-Encoding: gzip
Accept-Language: ru
Connection: Keep-Alive
User-Agent: AppleCoreMedia/1.0.0.20D67 (iPhone; U; CPU OS 16_3_1 like Mac OS X; ru_ru)
X-Forwarded-For: IP
X-Forwarded-Host: IP:PORT
X-Forwarded-Server: IP
X-Playback-Session-Id: D18FC256-C0DC-4AD1-9EE1-637EBCB3B6FC

2023/03/06 17:20:35 DEB [HLS] [conn 10.10.77.1] [s->c] HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: application/x-mpegURL
Server: rtsp-simple-server

yes

Did you attach a network dump?

no

@aler9
Copy link
Member

aler9 commented Apr 7, 2023

Hello,
In order to read a HLS stream from Safari iOS or any other player, the HLS stream must be valid.
In order for a HLS stream to be valid, it must contain at least 3 segments.
3 segments are available after i-frame interval * 3, where i-frame-interval is the interval between I-frames, which is a property of the stream.
In your case, Safari times out before the 3 segments are available; the second time you load the page the segments are available and the stream is read correctly.
Try setting the option hlsAlwaysRemux to true in order to start generating the HLS segments immediately and mitigate the issue.

@aler9 aler9 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2023
@arsyaCRK
Copy link
Author

When I have changed from hlsAlwaysRemux: no to hlsAlwaysRemux: yes the stream does not play at all.

Log before request the setam:
2023/04/11 12:48:13 INF reloading configuration (file changed)
2023/04/11 12:48:13 INF [API] listener is closing
2023/04/11 12:48:13 INF [HLS] listener is closing
2023/04/11 12:48:13 INF [HLS] listener opened on :8888
2023/04/11 12:48:13 INF [API] listener opened on 0.0.0.0:9997

Log after request HLS steam:
2023/04/11 12:48:13 INF [API] listener is closing
2023/04/11 12:48:13 INF [HLS] listener is closing
2023/04/11 12:48:13 INF [HLS] listener opened on :8888
2023/04/11 12:48:13 INF [API] listener opened on 0.0.0.0:9997
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:37 INF reloading configuration (API request)
2023/04/11 12:49:38 INF reloading configuration (API request)
2023/04/11 12:49:39 INF reloading configuration (API request)
2023/04/11 12:49:39 INF reloading configuration (API request)

and thats all. No steams started like this:
2023/04/11 12:45:07 INF [HLS] [muxer 2048_2] created (requested by 127.0.0.1)

@arsyaCRK
Copy link
Author

Sorry, but I fogot to say that "sourceOnDemand" will be in true for the steam.

@aler9
Copy link
Member

aler9 commented May 27, 2023

there was a bug that prevented generating HLS when sourceOnDemand and hlsAlwaysRemux are both true; this was fixed in #1834 and v0.23.1

Copy link
Contributor

This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants