Unmount audio/video tag when exiting player
This commit is contained in:
@@ -17,10 +17,6 @@ class UnplayableFileError extends PlaybackError {
|
||||
constructor () { super('Can\'t play that file') }
|
||||
}
|
||||
|
||||
class PlaybackTimedOutError extends PlaybackError {
|
||||
constructor () { super('Playback timed out. Try again.') }
|
||||
}
|
||||
|
||||
/* Sound */
|
||||
|
||||
class InvalidSoundNameError extends SoundError {
|
||||
@@ -42,7 +38,6 @@ module.exports = {
|
||||
TorrentError,
|
||||
UnplayableTorrentError,
|
||||
UnplayableFileError,
|
||||
PlaybackTimedOutError,
|
||||
InvalidSoundNameError,
|
||||
TorrentKeyNotFoundError,
|
||||
InvalidTorrentError
|
||||
|
||||
@@ -26,6 +26,15 @@ module.exports = class Player extends React.Component {
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
onComponentWillUnmount () {
|
||||
// Unload the media element so that Chromium stops trying to fetch data
|
||||
const tag = document.querySelector('audio,video')
|
||||
if (!tag) return
|
||||
tag.pause()
|
||||
tag.src = ''
|
||||
tag.load()
|
||||
}
|
||||
}
|
||||
|
||||
// Handles volume change by wheel
|
||||
|
||||
Reference in New Issue
Block a user