xqq / mpegts.js

HTML5 MPEG2-TS / FLV Stream Player
Apache License 2.0
1.61k stars 203 forks source link

Directly add a buffer programmatically? #40

Open EternityForest opened 2 years ago

EternityForest commented 2 years ago

I have a WS based server that streams video, but it is multiplexed with some other stuff in the same websocket.

Is there an API to feed the player directly with buffers of MPEG2-TS packets?

xqq commented 2 years ago

Construct a customized IO Loader with the following interface: https://github.com/xqq/mpegts.js/blob/master/src/io/loader.js

And then pass the class into player here: https://github.com/xqq/mpegts.js/blob/master/src/config.js#L53

xqq commented 2 years ago

https://github.com/xqq/mpegts.js/blob/master/src/io/websocket-loader.js This class could be a reference sample.