Unmount audio/video tag when exiting player

This commit is contained in:
DC
2016-09-23 01:15:51 -07:00
parent 0dd1683298
commit 3b6819f894
2 changed files with 9 additions and 5 deletions

View File

@@ -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