Currently, I'm having a bit of an issue with the MediaSource API for resuming live h264 playback. My server-side code will keep the first packet from FFmpeg, then dispatch it to clients. However, this works well but raises an issue.
When I restart the stream and it dispatches to the client(s), it goes as expected and this is the result I expect when a client disconnects then has to reconnect to the stream, is the aforementioned result
However, if I were to rejoin the stream, I get this as the result
Also, FFMpeg data is being sent to the client in the picture above, it's just not rendering it for some reason.
Here's my function for playing audio/video frames that I get from the server.
private _playFrame(type: 0 | 1) {
const src = type === 0 ? this.audioSource : this.videoSource;
if (!src || src.updating) return;
const queue = type === 0 ? this.audioFrameQueue : this.videoFrameQueue;
src.appendBuffer(queue.shift());
if (this.video.src && this.video.paused) this.video.play().then(() => null);
}