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

Live stream stops on Android Chrome if the screen turns off #217

Open
alejsanc opened this issue Nov 6, 2024 · 1 comment
Open

Live stream stops on Android Chrome if the screen turns off #217

alejsanc opened this issue Nov 6, 2024 · 1 comment

Comments

@alejsanc
Copy link

alejsanc commented Nov 6, 2024

In Android Chrome, if you turn off the screen, playback of the live stream stops and when you turn on the screen, it continues where it stopped instead of showing the current video.

@alejsanc alejsanc changed the title Live stream stops on android chrome if the screen turns off Live stream stops on Android Chrome if the screen turns off Nov 6, 2024
@alejsanc
Copy link
Author

I have found a solution. With the "visibilitychange" event we can detect when the page is visible again and restart the player. In order for the "visibilitychange" event to be sent when the screen is turned on, the screen must be locked.

document.onvisibilitychange = () => {
   if (document.visibilityState === "visible") {
      alert("Camera Reconnection");
      player.unload();
      player.load();
      player.play();
   }
};

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

1 participant