From f4cafdfd7e77ea6333724e594f77fe8497a55329 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 4 Aug 2021 14:42:10 +0200 Subject: [PATCH] fix muted state on load --- source/UI/js/Video/VideoElement.js | 12 ++++++++---- source/UI/js/Video/VideoPlayer.js | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/UI/js/Video/VideoElement.js b/source/UI/js/Video/VideoElement.js index 4df18fd9..64c5eaf6 100644 --- a/source/UI/js/Video/VideoElement.js +++ b/source/UI/js/Video/VideoElement.js @@ -31,6 +31,7 @@ Ox.VideoElement = function(options, self) { .defaults({ autoplay: false, loop: false, + muted: false, playbackRate: 1, items: [], volume: 1 @@ -103,6 +104,7 @@ Ox.VideoElement = function(options, self) { self.$video = self.$videos[self.currentVideo]; self.video = self.$video[0]; self.volume = self.options.volume; + self.muted = self.options.muted; self.$brightness = $('
').css({ width: '100%', height: '100%', @@ -332,7 +334,7 @@ Ox.VideoElement = function(options, self) { function setCurrentVideo(callback) { var css = {}, - muted = false, + muted = self.muted, item = self.items[self.currentItem], next; Ox.Log('Video', 'sCV', item); @@ -344,7 +346,6 @@ Ox.VideoElement = function(options, self) { if (self.video) { self.$videos[self.currentVideo].hide(); self.video.pause(); - muted = self.video.muted; } self.currentVideo = Ox.mod(self.currentVideo + 1, self.$videos.length); self.$video = self.$videos[self.currentVideo]; @@ -531,8 +532,11 @@ Ox.VideoElement = function(options, self) { /*@ muted get/set muted @*/ - that.muted = function() { - return getset('muted', arguments[0]); + that.muted = function(value) { + if (!Ox.isUndefined(value)) { + self.muted = value; + } + return getset('muted', value); }; /*@ diff --git a/source/UI/js/Video/VideoPlayer.js b/source/UI/js/Video/VideoPlayer.js index 005e831c..8df95916 100644 --- a/source/UI/js/Video/VideoPlayer.js +++ b/source/UI/js/Video/VideoPlayer.js @@ -444,6 +444,7 @@ Ox.VideoPlayer = function(options, self) { self.$video = Ox.VideoElement({ items: self.video, loop: self.options.loop, + muted: self.options.muted, playbackRate: self.options.playbackRate, volume: self.options.volume })