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

webrtc UDP stream continues even after web-browser closes #123

Open
kmusser2 opened this issue Dec 12, 2023 · 2 comments
Open

webrtc UDP stream continues even after web-browser closes #123

kmusser2 opened this issue Dec 12, 2023 · 2 comments

Comments

@kmusser2
Copy link

VERSION: camera-streamer-raspi_0.2.8.bookworm_arm64.deb

The webrtc video stream works very well -- starts quickly, reliably, and looks good.

However, if you close the browser and open wireshark on the client machine, filtering on UDP, you'll see UDP packets arriving from the camera device (in my case a Raspberry PI cm4). This UDP streams appears to continue indefinitely until the camera-streamer service is restarted. (I can't confirm if indeed it runs forever, but I have not seen it stop until the service is stopped.)

@opjose
Copy link

opjose commented Jan 16, 2024

I also see this in TCP, however once the recipient closes the target, e.g. browser, etc. the stream seems to pause.
If the browser, etc. is opened again the stream resumes even if quite some time has occurred.

@sarusani
Copy link

I believe the problem is that the "webrtc.html" never stops the stream. I think it should include something like:

document.onvisibilitychange = () => {
  if (document.visibilityState === "hidden") {
    pc.close();
  }
};

To close the stream if the browser/tab is closed.

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