From d5f1a42e6228f4ac18054f406756728bc0c5d1b9 Mon Sep 17 00:00:00 2001 From: Pete Cook Date: Sat, 23 May 2020 21:19:23 +0100 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 0163a7d6..933f5b98 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)