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 = {}) => {
5858 readFrames = true ;
5959 }
6060 } 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+ } ;
6368 readFrames = false ;
6469 } else if ( message . startsWith ( 'frame' ) || message . startsWith ( 'size' ) ) {
6570 const ts = message . split ( 'time=' ) [ 1 ] . split ( ' ' ) [ 0 ] ;
6671 const t = ts2sec ( ts ) ;
6772 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+ } ;
6978 prog ( { ratio, time : t } ) ;
7079 } else if ( message . startsWith ( 'video:' ) ) {
7180 prog ( { ratio : 1 } ) ;
You can’t perform that action at this time.
0 commit comments