File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 11let duration = 0 ;
2+ let ratio = 0 ;
23
34const ts2sec = ( ts ) => {
45 const [ h , m , s ] = ts . split ( ':' ) ;
@@ -10,13 +11,15 @@ module.exports = (message, progress) => {
1011 if ( message . startsWith ( ' Duration' ) ) {
1112 const ts = message . split ( ', ' ) [ 0 ] . split ( ': ' ) [ 1 ] ;
1213 const d = ts2sec ( ts ) ;
14+ progress ( { duration : d , ratio } ) ;
1315 if ( duration === 0 || duration > d ) {
1416 duration = d ;
1517 }
1618 } else if ( message . startsWith ( 'frame' ) || message . startsWith ( 'size' ) ) {
1719 const ts = message . split ( 'time=' ) [ 1 ] . split ( ' ' ) [ 0 ] ;
1820 const t = ts2sec ( ts ) ;
19- progress ( { ratio : t / duration } ) ;
21+ ratio = t / duration ;
22+ progress ( { ratio, time : t } ) ;
2023 } else if ( message . startsWith ( 'video:' ) ) {
2124 progress ( { ratio : 1 } ) ;
2225 duration = 0 ;
You can’t perform that action at this time.
0 commit comments