Issue #310 video volume reset fix

This commit is contained in:
Akinwale Ariwodola 2017-07-01 22:38:09 +01:00 committed by Jeremy Kauffman
parent d8e867aa5a
commit 444f230877

View file

@ -52,13 +52,23 @@ class VideoPlayer extends React.PureComponent {
once: true,
}
);
mediaElement.addEventListener(
"webkitfullscreenchange",
win32FullScreenChange.bind(this)
);
mediaElement.addEventListener("volumechange", () => {
localStorage.setItem("prefs_volume", mediaElement.volume);
});
mediaElement.volume = this.getPreferredVolume();
}
}
getPreferredVolume() {
const volumePreference = parseFloat(localStorage.getItem("prefs_volume"));
return isNaN(volumePreference) ? 1 : volumePreference;
}
componentDidUpdate() {
const { mediaType, downloadCompleted } = this.props;
const { startedPlaying } = this.state;