samirkumardas / jmuxer

jMuxer - a simple javascript mp4 muxer that works in both browser and node environment.
Other
559 stars 114 forks source link

Only Displaying White Page #114

Closed Marco77577 closed 2 years ago

Marco77577 commented 2 years ago

I serve an H.264 stream via websockets to my Angular frontend. I use JMuxer in the following way:

const socket = io(environment.websocketUrl);

const jmuxer = new JMuxer({
    node: 'player',
    mode: 'video',
    flushingTime: 1000,
    fps: 30,
    debug: true
});

socket.on(STREAM_ENDPOINT, (data) => {
    jmuxer.feed({
        video: new Uint8Array(data)
    });
});

with this in the HTML part:

<video autoplay
           controls
           height="200px"
           id="player"
           width="400px"></video>
</div>

The H.264 stream served can be displayed successfully via gstreamer, so the delivered data should be valid. gstreamer confirms FPS being 30. Here is a printscreen from the debug logs in the browser console. It looks like data is received and understood by jmuxer. image

Unfortunately, the video does not display. Not even when I click play. It just shows a white screen with the loading indicator spinning. image

Your library is absolutely awesome and it's the only thing that's been working so far. Help is greatly appreciated :) Am I missing anything?

samirkumardas commented 2 years ago

According to the log, it seems jMuxer fails to understand provided data. it is supposed to have more frames, but it shows 1 or 0 frames every time you feed the data.

Can you capture some data in a file and try to run vlc player? if it plays properly, can you try to play it using https://samirkumardas.github.io/jmuxer/h264_player.html let me know it does not play in jmuxer player

Marco77577 commented 2 years ago

Indeed there seems to be a problem with the stream, it plays neither in VLC nor in your example. I will have a look at it and get back to you.

Marco77577 commented 2 years ago

Without changing anything, I noticed that it is working in Firefox, but not on Brave browser.

Do you know why this might be?

Marco77577 commented 2 years ago

Turns out we were only sending a single IDR frame at the beginning. So when joining the stream later, there will not be any IDR frames anymore. Chrome apparently will not start the video without an IDR frame, while Firefox is somehow able to cope with this.

JMuxer is super, but might be improved by more extensive logging, so that you a bit more what's exactly going on. We were chasing a lot of ghosts this week.

ZedonZzz commented 1 year ago

Have you solved this problem? I also encountered a similar problem, which can be played normally in Firefox but can not be played in chrome

Marco77577 commented 1 year ago

As I have written above, the problem were missing IDR frames.