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 1
1
let duration = 0 ;
2
+ let ratio = 0 ;
2
3
3
4
const ts2sec = ( ts ) => {
4
5
const [ h , m , s ] = ts . split ( ':' ) ;
@@ -10,13 +11,15 @@ module.exports = (message, progress) => {
10
11
if ( message . startsWith ( ' Duration' ) ) {
11
12
const ts = message . split ( ', ' ) [ 0 ] . split ( ': ' ) [ 1 ] ;
12
13
const d = ts2sec ( ts ) ;
14
+ progress ( { duration : d , ratio } ) ;
13
15
if ( duration === 0 || duration > d ) {
14
16
duration = d ;
15
17
}
16
18
} else if ( message . startsWith ( 'frame' ) || message . startsWith ( 'size' ) ) {
17
19
const ts = message . split ( 'time=' ) [ 1 ] . split ( ' ' ) [ 0 ] ;
18
20
const t = ts2sec ( ts ) ;
19
- progress ( { ratio : t / duration } ) ;
21
+ ratio = t / duration ;
22
+ progress ( { ratio, time : t } ) ;
20
23
} else if ( message . startsWith ( 'video:' ) ) {
21
24
progress ( { ratio : 1 } ) ;
22
25
duration = 0 ;
You can’t perform that action at this time.
0 commit comments