diff --git a/src/index.js b/src/index.js index d22381f0..83b797cc 100644 --- a/src/index.js +++ b/src/index.js @@ -1348,7 +1348,10 @@ class VideoHandler { // Set video volume in 0.00-1.00 format setVideoVolume(volume) { if (this.site.host === "youtube") { - return youtubeUtils.setVideoVolume(volume); + const videoVolume = youtubeUtils.setVideoVolume(volume); + if (videoVolume) { + return; + } } this.video.volume = volume; } diff --git a/src/utils/youtubeUtils.js b/src/utils/youtubeUtils.js index b4d978ce..71684563 100644 --- a/src/utils/youtubeUtils.js +++ b/src/utils/youtubeUtils.js @@ -86,7 +86,11 @@ function getVideoVolume() { } function setVideoVolume(volume) { - return getPlayer()?.setVolume(Math.round(volume * 100)); + const player = getPlayer(); + if (player?.setVolume) { + player.setVolume(Math.round(volume * 100)); + return true; + } } function videoSeek(video, time) {