From c2eb196f3f766aafafd819668a5d482f1264befd Mon Sep 17 00:00:00 2001 From: "saurav.s" Date: Sat, 23 Oct 2021 21:09:43 +0530 Subject: [PATCH] Property seekTo Added to skeek to time in seconds --- src/default-props.js | 2 ++ src/helpers/get-player-opts.js | 1 + src/helpers/initialize.js | 5 +++++ src/player-prop-types.js | 2 ++ 4 files changed, 10 insertions(+) diff --git a/src/default-props.js b/src/default-props.js index deaa9505..ef6a6d3d 100644 --- a/src/default-props.js +++ b/src/default-props.js @@ -35,6 +35,8 @@ const defaultProps = { onBufferChange: noOp, playlist: '', useMultiplePlayerScripts: false, + seekTo: noOp, + }; export default defaultProps; diff --git a/src/helpers/get-player-opts.js b/src/helpers/get-player-opts.js index 2c834bca..a19ebe19 100644 --- a/src/helpers/get-player-opts.js +++ b/src/helpers/get-player-opts.js @@ -9,6 +9,7 @@ function getPlayerOpts(opts) { isMuted, licenseKey, playlist, + seekTo, } = opts; const hasAdvertising = !!generatePrerollUrl; diff --git a/src/helpers/initialize.js b/src/helpers/initialize.js index 676c2fd8..c380e506 100644 --- a/src/helpers/initialize.js +++ b/src/helpers/initialize.js @@ -15,6 +15,11 @@ function initialize({ component, player, playerOpts }) { if (eventName) { eventsToInitialize[eventName] = component.props[prop]; } + + if(prop === 'seekTo' && component.props[prop] > 0){ + player.seek(component.props[prop]); + } + }); eventsToInitialize.adPlay = component.eventHandlers.onAdPlay; diff --git a/src/player-prop-types.js b/src/player-prop-types.js index de82be6f..5813aee6 100644 --- a/src/player-prop-types.js +++ b/src/player-prop-types.js @@ -43,6 +43,8 @@ const propTypes = { PropTypes.array, ]), useMultiplePlayerScripts: PropTypes.bool, + seekTo: _propTypes2.default.number, + }; export default propTypes;