From 3c5c5cb2058c8d4eb1746450e0270480b31a0c40 Mon Sep 17 00:00:00 2001 From: Jonathan Baudanza Date: Mon, 12 Feb 2018 12:02:40 +0900 Subject: [PATCH] The user can adjust the playback rate --- src/components/Source.js | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/components/Source.js b/src/components/Source.js index f83c088..c5dc267 100644 --- a/src/components/Source.js +++ b/src/components/Source.js @@ -46,10 +46,21 @@ class VideoMedia extends Component { } } + setVideoRef = (el) => { + this.videoElem = el; + this.videoElem.playbackRate = this.props.playbackRate; + } + + componentDidUpdate(prevProps, prevState) { + if (prevProps.playbackRate !== this.props.playbackRate && this.videoElem) { + this.videoElem.playbackRate = this.props.playbackRate; + } + } + render() { const { media, initialTime, onTimeUpdate, onPlaying, onPause, onEnded, onSeeking } = this.props; return ( -