Streaming video from browser to deno server
Trying to stream video from Chrome to my local Deno server but having trouble understanding how to pipe things up correctly.
When I visit localhost:8000, which hits the /video endpont via the <video> element, the /receive endpoint throws this error:
Here's my setup:
Pasted into Chrome console:
Deno server:
1 Reply
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the error message and the code you've provided, it seems like the issue might be related to the writable stream being closed before the data is fully piped to it.
In the Deno server code, you're pushing writable streams to an array
writables
every time the /video
endpoint is hit. However, it's not clear from the provided code how and when these writable streams are being closed. If a writable stream is closed prematurely, it could cause the TypeError
you're seeing when you try to pipe to it.
One thing to check is whether the writable streams in the writables
array are being managed correctly. Ensure that they are not being closed before the piping is complete. Also, consider the lifecycle of these streams and how they should be cleaned up after they are no longer needed to prevent memory leaks.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. It's also a good idea to review the official Deno documentation or seek further assistance from the community if you continue to experience issues.