fix muted state on load

This commit is contained in:
j 2021-08-04 14:42:10 +02:00
parent fa93686845
commit f4cafdfd7e
2 changed files with 9 additions and 4 deletions

View file

@ -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 = $('<div>').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 <f> 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);
};
/*@

View file

@ -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
})