diff --git a/index.js b/index.js index 63956aa..b39ffe2 100644 --- a/index.js +++ b/index.js @@ -41,6 +41,11 @@ module.exports = async options => { if (error) { break } } + // Set currentTime to duration / 2 + // (fix for correctly invoking onseeked event for currentTime = 0 if the first frame is at 0 sec.) + video.currentTime = video.duration / 2; + await new Promise(resolve => { seekResolve = resolve; }); + // Set options to default values if not set fallbackToDefault('format', 'image/png') fallbackToDefault('offsets', []) diff --git a/package.json b/package.json index e314040..54ecb92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "video-frames", - "version": "1.0.13", + "version": "1.0.14", "private": false, "description": "Client-side video frames extraction as base64 encoded images", "author": "Utkarsh Verma",