Description
I am trying to work this library into one of my project and at the moment, I have once singular issue making it coexist with my current setup. I am already using websockets for sending data back and fourth between the client and server.
My setup:
The messages are in JSON and contain a channel field which I use to route them in the receive-event-listener to their corresponding sections of the application - chat, telemetry, control data etc...
I was thinking of creating a new channel for the video data, which I would push then push into the JSMpeg library somehow in order to display it.
However I can not find any way to achieve this. I can only provide a URL to my server which would however also push all the other messages to the JSMpeg.
Basically I am looking into some way to support channels, or pubsub broker. I have a my custom one, but there are multiple approaches out there: https://socket.io/ https://github.com/O3Labs/neo-ws-pub-sub... In order to use any of these methods, there has to be some way to 'push' data into the JSMpeg library.
I envision something along the lines of a player.pushData(data);
method which can be called from anywhere like this:
socket.on("message", (data) => {
if(data.type == 'video') {
player.pushData(data.videoData);
} else if (data.type == 'chat') {
// Handle chat data.....
}
/// ....etc
});
Or when using something like socket.io:
socket.on('video', (data)=>{
player.pushData(data);
});
// Or even simpler
socket.on('video', player.pushData);
I have looked at the #194 issue, and it looks like it might be related. However still not resolved.
I hope you can provide some advise and help. Thanks