Closed canbing3345 closed 6 years ago
Hey @canbing3345 , videojs-contrib-hls is meant to support playback of HLS content, which requires an m3u8 manifest. Though we do support TS playback within the project (as HLS manifests may use TS segments), we don't have a way of providing that feature directly. However, you can feel free to use some of the logic and other projects used by videojs-contrib-hls to write a video.js plugin yourself to play back TS files directly. To do that, you'd probably want to use https://github.com/videojs/mux.js to transmux those TS files to MP4 files before appending to the browser via a source buffer https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer.
It may help to look through some of the logic of videojs-contrib-hls to do that. Specifically, https://github.com/videojs/videojs-contrib-media-sources/blob/master/src/virtual-source-buffer.js#L506 in videojs-contrib-media-sources is the start of where we abstract away the native source buffer's appendBuffer
function, and send the TS bytes to a WebWorker wrapped around mux.js, get back bytes for a fragmented mp4, then append those to the native source buffer.
Using those methods it should definitely be possible to pass TS data over a websocket, transmux it, then append it to the browser's native source buffer.
Hope this helps!
Description
It can play M3U8, that is, it can play video in MPEG2-TS format. But how to skip the M3U8 file and play MPEG2-TS directly. Is there an API that can be used? Please give me a hint or demo.
Is it possible to pass the TS data over the websocket and then parse it?