mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Updated event handling for custom video player
refs https://github.com/TryGhost/Team/issues/1229
This commit is contained in:
parent
61f7f29eed
commit
a6a25dbb77
1 changed files with 18 additions and 4 deletions
|
@ -162,19 +162,22 @@
|
|||
handleOnPause();
|
||||
});
|
||||
|
||||
muteIconContainer.addEventListener('click', () => {
|
||||
muteIconContainer.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
muteIconContainer.classList.add("kg-video-hide");
|
||||
unmuteIconContainer.classList.remove("kg-video-hide");
|
||||
videoEl.muted = false;
|
||||
});
|
||||
|
||||
unmuteIconContainer.addEventListener('click', () => {
|
||||
unmuteIconContainer.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
unmuteIconContainer.classList.add("kg-video-hide");
|
||||
muteIconContainer.classList.remove("kg-video-hide");
|
||||
videoEl.muted = true;
|
||||
});
|
||||
|
||||
playbackRateContainer.addEventListener('click', () => {
|
||||
playbackRateContainer.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
let nextPlaybackRate = playbackRates[(currentPlaybackRateIdx + 1) % 5];
|
||||
currentPlaybackRateIdx = currentPlaybackRateIdx + 1;
|
||||
videoEl.playbackRate = nextPlaybackRate.rate;
|
||||
|
@ -184,6 +187,7 @@
|
|||
videoEl.addEventListener('progress', displayBufferedAmount);
|
||||
|
||||
seekSlider.addEventListener('input', (e) => {
|
||||
e.stopPropagation();
|
||||
showRangeProgress(e.target);
|
||||
currentTimeContainer.textContent = calculateTime(seekSlider.value);
|
||||
if (!videoEl.paused) {
|
||||
|
@ -191,14 +195,24 @@
|
|||
}
|
||||
});
|
||||
|
||||
seekSlider.addEventListener('change', () => {
|
||||
seekSlider.addEventListener('change', (event) => {
|
||||
event.stopPropagation();
|
||||
videoEl.currentTime = seekSlider.value;
|
||||
if (!videoEl.paused) {
|
||||
requestAnimationFrame(whilePlaying);
|
||||
}
|
||||
});
|
||||
|
||||
volumeSlider.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
seekSlider.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
volumeSlider.addEventListener('input', (e) => {
|
||||
e.stopPropagation();
|
||||
const value = e.target.value;
|
||||
showRangeProgress(e.target);
|
||||
videoEl.volume = value / 100;
|
||||
|
|
Loading…
Add table
Reference in a new issue