From cc00b42e21c1849f7fc8a85acba7fb6be128d15c Mon Sep 17 00:00:00 2001 From: Abdelalim-dev Date: Wed, 5 Apr 2023 16:23:12 +0100 Subject: [PATCH] feat: allow to start the video programatically --- index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/index.js b/index.js index 513f4e3..dae9528 100644 --- a/index.js +++ b/index.js @@ -376,6 +376,21 @@ export default class VideoPlayer extends Component { this.seek(0); this.showControls(); } + + start() { + if (this.props.onStart) { + this.props.onStart(); + } + + this.setState(state => ({ + isPlaying: true, + isStarted: true, + hasEnded: false, + progress: state.progress === 1 ? 0 : state.progress, + })); + + this.hideControls(); + } pause() { this.player && this.player.setNativeProps({