set and get playerVolume from localStorage
This commit is contained in:
parent
1188e66f37
commit
6bc0111d0a
|
@ -546,7 +546,7 @@ function createVideoTag(videoData, videoProgress) {
|
|||
}
|
||||
|
||||
let videoTag = `
|
||||
<video poster="${videoThumbUrl}" ontimeupdate="onVideoProgress()" onpause="onVideoPause()" onended="onVideoEnded()" controls autoplay width="100%" playsinline id="video-item">
|
||||
<video poster="${videoThumbUrl}" onvolumechange="onVolumeChange(this)" onloadstart="this.volume=getPlayerVolume()" ontimeupdate="onVideoProgress()" onpause="onVideoPause()" onended="onVideoEnded()" controls autoplay width="100%" playsinline id="video-item">
|
||||
<source src="${videoUrl}#t=${videoProgress}" type="video/mp4" id="video-source" videoid="${videoId}">
|
||||
${subtitles}
|
||||
</video>
|
||||
|
@ -554,6 +554,14 @@ function createVideoTag(videoData, videoProgress) {
|
|||
return videoTag;
|
||||
}
|
||||
|
||||
function onVolumeChange(videoTag) {
|
||||
localStorage.setItem('playerVolume', videoTag.volume);
|
||||
}
|
||||
|
||||
function getPlayerVolume() {
|
||||
return localStorage.getItem('playerVolume') ?? 1;
|
||||
}
|
||||
|
||||
// Gets video tag
|
||||
function getVideoPlayer() {
|
||||
let videoElement = document.getElementById('video-item');
|
||||
|
|
Loading…
Reference in New Issue