From 0695c9210093b42f9df3a5410fa72b35150ed25e Mon Sep 17 00:00:00 2001 From: Jonathan New Date: Sat, 15 Feb 2020 21:55:04 -0800 Subject: [PATCH] Allow seeking via command line flag to already playing video --- index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index b5537be..dd4f20a 100755 --- a/index.js +++ b/index.js @@ -227,7 +227,15 @@ var ctrl = function(err, p, ctx) { p.on('playing', updateTitle); if (!ctx.options.disableSeek && ctx.options.seek) { - p.once('playing', initialSeek); + p.getStatus(function(err, status){ + if(status.playerState == 'PLAYING'){ + debug("already playing, seeking now"); + initialSeek(); + } + else{ + p.once('playing', initialSeek); + } + }); } updateTitle();