samirkumardas / jmuxer

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

A strange question #5

Closed hahashigehaha closed 6 years ago

hahashigehaha commented 6 years ago

It didn't run before because I didn't call the play method of video element. After the normal operation, I open your debug mode, and when first log prints out (video remove range [0 - 6.097455)), this sentence stops running and doesn't play .

samirkumardas commented 6 years ago

If you set clearBuffer true while jmuxer instantiation, it clear buffer that has already been played. If you don't need want to clear buffer, you can set clearBuffer to false.

hahashigehaha commented 6 years ago

yeah,it's ok! but i think it's a bug. if i make clearBuffer true , only show frame before first clearBuffer .

samirkumardas commented 6 years ago

Will look into when I get some. Thanks by the way!

bp2008 commented 6 years ago

I noticed this problem too, and I believe I know the cause. It happens when jmuxer's buffer clear operation deletes the last keyframe. This happens every time if I encode my source stream with an i-frame interval longer than 10 seconds.

By the way, this is a fantastic library. Exactly what I was looking for. Browsers should have this API as a standard, because it is just too useful.

bp2008 commented 6 years ago

It looks like jmuxer deletes everything older than two seconds (see the "cleanOffset" variable), but it needs to make sure it never deletes the most recent keyframe.

samirkumardas commented 6 years ago

As I mentioned earlier use clearBuffer false

bp2008 commented 6 years ago

I'm fully aware of that :) I'm a little concerned about what might happen long-term if never clearing the buffers, though, so I just had my code reach in and change the cleanOffset value. Thanks for making so many internal variables public. That really helps.

samirkumardas commented 6 years ago

:) True, if you don't clear buffer, you will get buffer limit exceeded exception after some time. I will look this issue.

bp2008 commented 6 years ago

I think your fix didn't work. I updated to the latest jmuxer and took out my hack of the cleanOffset variable, and now my streams freeze at the 10 second mark again (with a 20 second keyframe interval). Tested in Chrome and Firefox.

samirkumardas commented 6 years ago

you are right, there was an issue for longer keyframe gap. I have pushed another update. It should fix the issue. thanks