Issue #310 video volume reset fix
This commit is contained in:
parent
d8e867aa5a
commit
444f230877
1 changed files with 10 additions and 0 deletions
|
@ -52,13 +52,23 @@ class VideoPlayer extends React.PureComponent {
|
||||||
once: true,
|
once: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
mediaElement.addEventListener(
|
mediaElement.addEventListener(
|
||||||
"webkitfullscreenchange",
|
"webkitfullscreenchange",
|
||||||
win32FullScreenChange.bind(this)
|
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() {
|
componentDidUpdate() {
|
||||||
const { mediaType, downloadCompleted } = this.props;
|
const { mediaType, downloadCompleted } = this.props;
|
||||||
const { startedPlaying } = this.state;
|
const { startedPlaying } = this.state;
|
||||||
|
|
Loading…
Reference in a new issue