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') }
|
constructor () { super('Can\'t play that file') }
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlaybackTimedOutError extends PlaybackError {
|
|
||||||
constructor () { super('Playback timed out. Try again.') }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sound */
|
/* Sound */
|
||||||
|
|
||||||
class InvalidSoundNameError extends SoundError {
|
class InvalidSoundNameError extends SoundError {
|
||||||
@@ -42,7 +38,6 @@ module.exports = {
|
|||||||
TorrentError,
|
TorrentError,
|
||||||
UnplayableTorrentError,
|
UnplayableTorrentError,
|
||||||
UnplayableFileError,
|
UnplayableFileError,
|
||||||
PlaybackTimedOutError,
|
|
||||||
InvalidSoundNameError,
|
InvalidSoundNameError,
|
||||||
TorrentKeyNotFoundError,
|
TorrentKeyNotFoundError,
|
||||||
InvalidTorrentError
|
InvalidTorrentError
|
||||||
|
|||||||
@@ -26,6 +26,15 @@ module.exports = class Player extends React.Component {
|
|||||||
</div>
|
</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
|
// Handles volume change by wheel
|
||||||
|
|||||||
Reference in New Issue
Block a user