Skip to content

Killing the web socket connection when modal closes #42

Answered by k-yle
tesla-srt asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, if you initialized the player on the client side using loadPlayer (see recently updated README), then you make use of the Player object that is returned by that promise.

For example:

const player = await loadPlayer({
  url: 'ws://' + location.host + '/api/stream',
  canvas: document.getElementById('canvas')
});

player.destroy();

If you want to be certain that it works, on the server side, add verbose: true to proxy({ url: "..." })and you'll see a message printed that says "no clients left; destroying stream"

Hope this helps!

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@tesla-srt
Comment options

@rakeshraushan1997
Comment options

@k-yle
Comment options

Answer selected by k-yle
Comment options

You must be logged in to vote
1 reply
@k-yle
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants