File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,23 @@ module.exports = (_options = {}) => {
58
58
readFrames = true ;
59
59
}
60
60
} else if ( readFrames && message . startsWith ( ' Stream' ) ) {
61
- const fps = parseFloat ( message . match ( / ( \d + ) f p s / ) [ 1 ] ) ;
62
- frames = duration * fps ;
61
+ const match = message . match ( / ( \d + ) f p s / ) ;
62
+ if ( match ) {
63
+ const fps = parseFloat ( match [ 1 ] ) ;
64
+ frames = duration * fps ;
65
+ } else {
66
+ frames = 0 ;
67
+ } ;
63
68
readFrames = false ;
64
69
} else if ( message . startsWith ( 'frame' ) || message . startsWith ( 'size' ) ) {
65
70
const ts = message . split ( 'time=' ) [ 1 ] . split ( ' ' ) [ 0 ] ;
66
71
const t = ts2sec ( ts ) ;
67
72
const f = parseFloat ( message . match ( / f r a m e = \s * ( \d + ) / ) [ 1 ] ) ;
68
- ratio = Math . min ( f / frames , 1 ) ;
73
+ if ( frames ) {
74
+ ratio = Math . min ( f / frames , 1 ) ;
75
+ } else {
76
+ ratio = t / duration ;
77
+ } ;
69
78
prog ( { ratio, time : t } ) ;
70
79
} else if ( message . startsWith ( 'video:' ) ) {
71
80
prog ( { ratio : 1 } ) ;
You can’t perform that action at this time.
0 commit comments