From da90aa7cd18ffa2a785ab0509a51c12f400d1588 Mon Sep 17 00:00:00 2001 From: NikolaBorislavovHristov Date: Tue, 13 Nov 2018 09:29:07 +0200 Subject: [PATCH] use new react ref api in HTMLVideo --- src/routes/Player/stremio-video/ReactHTMLVideo.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/routes/Player/stremio-video/ReactHTMLVideo.js b/src/routes/Player/stremio-video/ReactHTMLVideo.js index 3a371f5ee..97590d1d7 100644 --- a/src/routes/Player/stremio-video/ReactHTMLVideo.js +++ b/src/routes/Player/stremio-video/ReactHTMLVideo.js @@ -3,8 +3,14 @@ import PropTypes from 'prop-types'; import HTMLVideo from './HTMLVideo'; class ReactHTMLVideo extends Component { + constructor(props) { + super(props); + + this.videoRef = React.createRef(); + } + componentDidMount() { - this.video = new HTMLVideo(this.videoElement); + this.video = new HTMLVideo(this.videoRef.current); this.video.addListener('propChanged', this.props.onPropChanged); this.video.addListener('propValue', this.props.onPropValue); this.video.addListener('error', this.props.onError); @@ -25,17 +31,13 @@ class ReactHTMLVideo extends Component { return false; } - assignVideoElement = (videoElement) => { - this.videoElement = videoElement; - } - dispatch = (...args) => { this.video.dispatch(...args); } render() { return ( - + ); } }