From 5cf2afaecfabf303793174dc89703081c0770f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Mon, 15 Nov 2021 15:12:13 +0800 Subject: [PATCH] fix error --- modules/ad_banner/_ad_banner_widget2_video.html.erb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/ad_banner/_ad_banner_widget2_video.html.erb b/modules/ad_banner/_ad_banner_widget2_video.html.erb index 1ed322f..83e621f 100644 --- a/modules/ad_banner/_ad_banner_widget2_video.html.erb +++ b/modules/ad_banner/_ad_banner_widget2_video.html.erb @@ -68,7 +68,12 @@ if ($video.length>0){ $self.jPlayer("mute", !$self.data().jPlayer.options.muted); }else{//youtube - $self.find('iframe').data("yt_player").unMute(); + var player = $self.find('iframe').data("yt_player"); + if (player.isMuted()){ + player.unMute(); + }else{ + player.mute(); + } } }); $self.append(audio_div); @@ -88,8 +93,10 @@ ad_banners_count++; }) if (typeof onYouTubeIframeAPIReady !== 'function'){ - $(document).delegate(".jarallax-video-audio",'touchstart,click',function(){ - $(this).trigger('click'); + $(document).ready(function() { + $(document).delegate(".jarallax-video-audio",'touchstart,click',function(){ + $(this).trigger('click'); + }); }); if(window.yt_players == undefined) window.yt_players = {};