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

Browser Freezes When Using P2P with Shaka Player on Long Live Streams #448

Open
OrionCodeDev opened this issue Nov 25, 2024 · 4 comments
Open

Comments

@OrionCodeDev
Copy link

Hello,
I'm experiencing a severe issue with the P2P Media Loader when integrated with Shaka Player for live streaming. When streaming a live HLS stream that has been running for a very long time (e.g., several hours, resulting in a very long playlist), the browser freezes entirely every time I refresh the page. This happens consistently and only when the bindShakaPlayer method is invoked, indicating that the problem is likely within the P2P integration.

Problem Details:
• When the live stream has been active for a long duration, the HLS playlist (.m3u8 file) becomes very large, containing references to all segments since the stream started.
• With P2P Media Loader integrated and bindShakaPlayer executed, loading the page causes the entire browser to freeze and become unresponsive.
• This issue does not occur when:
- The live stream has a shorter duration (shorter playlist).
- P2P Media Loader is not integrated (i.e., when bindShakaPlayer is not called).

• Adjusting Shaka Player's buffering and streaming configurations does not resolve the issue.
• Adjusting P2P Media Loader's configurations such as highDemandTimeWindow, p2pDownloadTimeWindow, httpDownloadTimeWindow, and cachedSegmentsCount does not prevent the freeze.

Steps to Reproduce:

  1. Set up a long-duration live HLS stream:
    o Use a live stream that has been running for several hours to ensure the playlist is very long.
    o The playlist should include references to all segments from the beginning of the stream.
  2. Create index.html:
  3. Create script.js:
  4. Host the files and load index.html in the browser.
  5. Observe that the browser becomes unresponsive and freezes completely.

Additional Observations:
• Removing the engine.bindShakaPlayer(player); line allows the stream to play normally without freezing, but without P2P functionality.
• The issue appears to be related to the P2P engine's handling of the long playlist, possibly trying to process or cache all historical segments.
• Adjusting P2P configurations does not seem to limit the engine's processing to only recent segments near the live edge.
• The browser's CPU usage spikes significantly when the freeze occurs, indicating a potential infinite loop or heavy processing task.

Questions:

  1. Is there a way to configure the P2P Media Loader to handle long live streams efficiently without freezing the browser?
  2. Can the P2P engine be instructed to ignore old segments and focus only on segments near the live edge?
  3. Is this a known issue, and are there any workarounds or patches available?

Attachments:
• index.html and script.js as provided above.

Thank you for your assistance. Any guidance or recommendations would be greatly appreciated.

shaka-lag.zip

@OrionCodeDev
Copy link
Author

Hello @DimaDemchenko ,

Thank you for your prompt response and for taking the time to investigate the issue.

It appears that the previous live HLS stream link I provided may have expired. Here is a new link to a live stream that demonstrates the problem:

To address your questions:

  1. Does this problem occur across different devices, browsers, or is it isolated to specific hardware or configurations?

    Yes, I have tested this on multiple devices and across different browsers, and the issue consistently occurs in all cases.

  2. Could you provide details about the setup in which the problem occurs (e.g., operating system, browser version, hardware specifications)?

    • Operating System: Windows 11 (latest version)
    • Browser: Chrome Version 131.0.6778.86 (Official Build) (64-bit)
    • Processor: AMD Ryzen 9 5900X
    • RAM: 32 GB
  3. Was your page active or inactive when the issue was observed?

    The issue occurs immediately upon page load when Shaka Player begins loading the .m3u8 manifest. The page is active at this time.

  4. Did you test with multiple peers in the network, or were you the only one?

    I have tested this scenario both when I am the only peer and when multiple peers are present on the network. In all situations, everyone experiences the same freezing effect.

  5. Did you watch the stream close to the live edge, or did you seek back to an earlier point in the playlist?

    The problem arises during the initial page load, before any user interaction with the seek bar is possible. Therefore, it occurs regardless of whether the stream is near the live edge or not.

Thank you again for your assistance. Any guidance or recommendations you can provide would be greatly appreciated.

Best regards

@DimaDemchenko
Copy link
Contributor

@OrionCodeDev Thank you for your response! Shortly after posting my additional questions, I managed to reproduce the bug and removed the post since the answers were no longer necessary. I appreciate you pointing that out, and I’ll look into the issue further. I’ll follow up if I have any updates or need more clarification.

@maxmgc
Copy link

maxmgc commented Dec 27, 2024

Hello friends, I have a P2P structure based on Novage, but the app is completely out of date. If I send files to us, can you help me with this structure? I have a panel that gets the contents of Xtream.

@maxmgc
Copy link

maxmgc commented Dec 27, 2024

Obtém conteúdos do xtream ui passa pelo fluxonic e os filmes baixa direto pra dentro do servidor ele funciona tudo na real porém tem bugs no app em questão do player que e o clappr e o pior dele e o SDK tá todo desatualizado Android Studio novo né funciona ele e dispositivos Android novos nem vai instalar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants