Open PhilAndrew opened 8 years ago
Interesting idea. From what I can see online, it doesn't look like live-streaming is something supported by HTML5 at the moment, so maybe webRTC is your best bet? Even though it is a bit dated, this might help to serve as a sample.
Other than that, maybe one can add a conversion to JPEG and simply send those down a websocket connection and update an img holder on the client side.
Nevertheless, great idea that is quite interesting :)
Yes in html5 canvas there is a method putImageData which can take the binary data of the image, binary data can come from a websocket connection to the server, I'll investigate, I can use Akka HTTP. For my usage it needs to be relatively efficient, I don't want to see the client browser cpu go right up.
You may have thought about this already, but just to be clear, that solution as it currently is, doesn't handle sound.
Hi ! (Maybe you could consider this as your next blog article, or help me slightly to find out how to go about doing it)
What I want in generate is to be able to stream video to the browser from your example. I first considered webRTC but then I find that the HTML5 video tag seems better on the client and streaming video from the server. At least I find its difficult to find a webRTC server library which allows webRTC server to be part of the peer group and send video.
The only problem is that the server needs to encode the video frames in real-time using some streaming library to send the video to the client side.
Refer: https://github.com/retroryan/streams-workshop/blob/master/src/library/video/file/FFMpegProducer.scala
https://github.com/retroryan/streams-workshop/tree/master/src/library/video
https://github.com/coreyauger/akka-webrtc
https://github.com/artclarke/humble-video