Revert to duration ratio for audio
This commit is contained in:
parent
90cb1b77da
commit
f5cd68c8a2
@ -58,14 +58,23 @@ module.exports = (_options = {}) => {
|
||||
readFrames = true;
|
||||
}
|
||||
} else if (readFrames && message.startsWith(' Stream')) {
|
||||
const fps = parseFloat(message.match(/(\d+) fps/)[1]);
|
||||
frames = duration * fps;
|
||||
const match = message.match(/(\d+) fps/);
|
||||
if (match) {
|
||||
const fps = parseFloat(match[1]);
|
||||
frames = duration * fps;
|
||||
} else {
|
||||
frames = 0;
|
||||
};
|
||||
readFrames = false;
|
||||
} else if (message.startsWith('frame') || message.startsWith('size')) {
|
||||
const ts = message.split('time=')[1].split(' ')[0];
|
||||
const t = ts2sec(ts);
|
||||
const f = parseFloat(message.match(/frame=\s*(\d+)/)[1]);
|
||||
ratio = Math.min(f / frames, 1);
|
||||
if (frames) {
|
||||
ratio = Math.min(f / frames, 1);
|
||||
} else {
|
||||
ratio = t / duration;
|
||||
};
|
||||
prog({ ratio, time: t });
|
||||
} else if (message.startsWith('video:')) {
|
||||
prog({ ratio: 1 });
|
||||
|
Loading…
Reference in New Issue
Block a user