From e87248b961cfbe294a6b85646f41eaf0b19e0d9d Mon Sep 17 00:00:00 2001 From: webmiraclepro Date: Fri, 22 May 2020 12:19:23 +0800 Subject: [PATCH] Reset hls and dash before loading new url Fixes https://github.com/CookPete/react-player/issues/892 Closes https://github.com/CookPete/react-player/pull/874 --- src/players/FilePlayer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/players/FilePlayer.js b/src/players/FilePlayer.js index 0163a7d..933f5b9 100644 --- a/src/players/FilePlayer.js +++ b/src/players/FilePlayer.js @@ -122,6 +122,12 @@ export default class FilePlayer extends Component { load (url) { const { hlsVersion, hlsOptions, dashVersion } = this.props.config + if (this.hls) { + this.hls.destroy() + } + if (this.dash) { + this.dash.reset() + } if (this.shouldUseHLS(url)) { getSDK(HLS_SDK_URL.replace('VERSION', hlsVersion), HLS_GLOBAL).then(Hls => { this.hls = new Hls(hlsOptions)