问题描述
我安装了模块旋转滑块 opencart 2.3 视频滑块工作正常,但不适用于移动设备
网站:etolshop.com.ua
我不明白为什么在移动设备上跳过视频
有js代码,我想,需要更正。
我试图 // 前两个字符串,但什么也没发生
请帮我我不知道该怎么办
// START OF HTML5 VIDEOS
//if ((is_mobile() && nextcaption.data('disablevideoonmobile')==1) ||isIE(8)) nextcaption.find('video').remove();
//if (is_mobile() && jQuery(window).width()<569) nextcaption.find('video').remove()
if (nextcaption.find('video').length>0) {
nextcaption.find('video').each(function(i) {
var video = this,jvideo = jQuery(this);
if (!jvideo.parent().hasClass("html5vid"))
jvideo.wrap('<div class="html5vid videoisplaying" style="position:relative;top:0px;left:0px;width:auto;height:auto"></div>');
var html5vid = jvideo.parent();
// WAITING FOR Meta DATAS
addEvent(video,'loadedMetadata',function(html5vid) {
html5vid.data('Metaloaded',1);
}(html5vid));
clearInterval(html5vid.data('interval'));
html5vid.data('interval',setInterval(function() {
if (html5vid.data('Metaloaded')==1 || video.duration!=NaN) {
clearInterval(html5vid.data('interval'));
// FirsT TIME LOADED THE HTML5 VIDEO
if (!html5vid.hasClass("HasListener")) {
html5vid.addClass("HasListener");
if (nextcaption.data('dottedoverlay')!="none" && nextcaption.data('dottedoverlay')!=undefined)
if (nextcaption.find('.tp-dottedoverlay').length!=1)
html5vid.append('<div class="tp-dottedoverlay '+nextcaption.data('dottedoverlay')+'"></div>');
if (jvideo.attr('control') == undefined ) {
if (html5vid.find('.tp-video-play-button').length==0)
html5vid.append('<div class="tp-video-play-button"><i class="revicon-right-dir"></i><div class="tp-revstop"></div></div>');
html5vid.parent().find('video,.tp-poster,.tp-thumb-image,.tp-video-play-button').click(function() {
if (html5vid.hasClass("videoisplaying")){
video.pause();
} else {
video.play();
punchgs.TweenLite.to(html5vid.parent().find('.tp-poster,.tp-thumb-image'),0.2,{autoAlpha:0});
}
})
}
if (nextcaption.data('forcecover')==1 || nextcaption.hasClass('fullscreenvideo')) {
if (nextcaption.data('forcecover')==1) {
updateHTML5Size(html5vid,opt.container);
html5vid.addClass("fullcoveredvideo");
nextcaption.addClass("fullcoveredvideo");
}
html5vid.css({width:"100%",height:"100%"});
}
var playButton = nextcaption.find('.tp-vid-play-pause')[0],muteButton = nextcaption.find('.tp-vid-mute')[0],fullScreenButton = nextcaption.find('.tp-vid-full-screen')[0],seekBar = nextcaption.find('.tp-seek-bar')[0],volumeBar = nextcaption.find('.tp-volume-bar')[0];
if (playButton!=undefined) {
// Event listener for the play/pause button
addEvent(playButton,"click",function() {
if (video.paused == true)
// Play the video
video.play();
else
// Pause the video
video.pause();
});
// Event listener for the mute button
addEvent(muteButton,function() {
if (video.muted == false) {
// Mute the video
video.muted = true;
// Update the button text
muteButton.innerHTML = "Unmute";
} else {
// Unmute the video
video.muted = false;
// Update the button text
muteButton.innerHTML = "Mute";
}
});
// Event listener for the full-screen button
addEvent(fullScreenButton,function() {
if (video.requestFullscreen) {
video.requestFullscreen();
} else if (video.mozRequestFullScreen) {
video.mozRequestFullScreen(); // Firefox
} else if (video.webkitRequestFullscreen) {
video.webkitRequestFullscreen(); // Chrome and Safari
}
});
// Event listener for the seek bar
addEvent(seekBar,"change",function() {
// Calculate the new time
var time = video.duration * (seekBar.value / 100);
// Update the video time
video.currentTime = time;
});
// Update the seek bar as the video plays
addEvent(video,"timeupdate",function() {
// Calculate the slider value
var value = (100 / video.duration) * video.currentTime;
// Update the slider value
seekBar.value = value;
});
// Pause the video when the seek handle is being dragged
addEvent(seekBar,"mousedown",function() {
video.pause();
});
// Play the video when the seek handle is dropped
addEvent(seekBar,"mouseup",function() {
video.play();
});
// Event listener for the volume bar
addEvent(volumeBar,function() {
// Update the video volume
video.volume = volumeBar.value;
});
}
// VIDEO EVENT LISTENER FOR "PLAY"
addEvent(video,"play",function() {
if (nextcaption.data('volume')=="mute")
video.muted=true;
html5vid.addClass("videoisplaying");
if (nextcaption.data('videoloop')=="loopandnoslidestop") {
opt.videoplaying=false;
opt.container.trigger('starttimer');
opt.container.trigger('revolution.slide.onvideostop');
} else {
opt.videoplaying=true;
opt.container.trigger('stoptimer');
opt.container.trigger('revolution.slide.onvideoplay');
}
var playButton = nextcaption.find('.tp-vid-play-pause')[0],muteButton = nextcaption.find('.tp-vid-mute')[0];
if (playButton!=undefined)
playButton.innerHTML = "Pause";
if (muteButton!=undefined && video.muted)
muteButton.innerHTML = "Unmute";
});
// VIDEO EVENT LISTENER FOR "PAUSE"
addEvent(video,"pause",function() {
html5vid.removeClass("videoisplaying");
opt.videoplaying=false;
opt.container.trigger('starttimer');
opt.container.trigger('revolution.slide.onvideostop');
var playButton = nextcaption.find('.tp-vid-play-pause')[0];
if (playButton!=undefined)
playButton.innerHTML = "Play";
});
// VIDEO EVENT LISTENER FOR "END"
addEvent(video,"ended",function() {
html5vid.removeClass("videoisplaying");
opt.videoplaying=false;
opt.container.trigger('starttimer');
opt.container.trigger('revolution.slide.onvideostop');
if (opt.nextslideatend==true)
opt.container.revnext();
});
} // END OF LISTENER DECLaraTION
var autoplaywason = false;
if (nextcaption.data('autoplayonlyfirsttime') == true || nextcaption.data('autoplayonlyfirsttime')=="true")
autoplaywason = true;
var mediaaspect=16/9;
if (nextcaption.data('aspectratio')=="4:3") mediaaspect=4/3;
html5vid.data('mediaAspect',mediaaspect);
if (html5vid.closest('.tp-caption').data('forcecover')==1) {
updateHTML5Size(html5vid,opt.container);
html5vid.addClass("fullcoveredvideo");
}
jvideo.css({display:"block"});
opt.nextslideatend = nextcaption.data('nextslideatend');
if (nextcaption.data('forcerewind')=="on" && !html5vid.hasClass("videoisplaying"))
if (video.currentTime>0) video.currentTime=0;
// IF VIDEO SHOULD BE AutopLAYED
if (nextcaption.data('autoplay')==true || autoplaywason==true) {
if (nextcaption.data('videoloop')=="loopandnoslidestop") {
opt.videoplaying=false;
opt.container.trigger('starttimer');
opt.container.trigger('revolution.slide.onvideostop');
} else {
opt.videoplaying=true;
opt.container.trigger('stoptimer');
opt.container.trigger('revolution.slide.onvideoplay');
}
if (nextcaption.data('forcerewind')=="on" && !html5vid.hasClass("videoisplaying"))
if (video.currentTime>0) video.currentTime=0;
if (nextcaption.data('volume')=="mute")
video.muted = true;
html5vid.data('timerplay',setTimeout(function() {
if (nextcaption.data('forcerewind')=="on" && !html5vid.hasClass("videoisplaying"))
if (video.currentTime>0) video.currentTime=0;
if (nextcaption.data('volume')=="mute")
video.muted = true;
video.play();
},10+nextcaption.data('start')));
}
if (html5vid.data('ww') == undefined) html5vid.data('ww',jvideo.attr('width'));
if (html5vid.data('hh') == undefined) html5vid.data('hh',jvideo.attr('height'));
if (!nextcaption.hasClass("fullscreenvideo") && nextcaption.data('forcecover')==1) {
try{
html5vid.width(html5vid.data('ww')*opt.bw);
html5vid.height(html5vid.data('hh')*opt.bh);
} catch(e) {}
}
clearInterval(html5vid.data('interval'));
}
}),100); // END OF SET INTERVAL
});
} // END OF HTML5 VIDEO FUNCTIONS
我创建了一段代码,可以用 disablevideoonmobile 进行派对
$htmlVideoAutoplay = "";
$htmlVideoAutoplayOnlyFirstTime = "";
$htmlVideoNextSlide = "";
$htmlVideoThumbnail = "";
$htmlMute = '';
$htmlCover = '';
$htmlDotted = '';
$htmlRatio = '';
$htmlRewind = '';
$htmldisableOnMobile = '';
以及以下 200 个字符串:
$htmldisableOnMobile = ($disable_on_mobile) ? ' data-
disablevideoonmobile="1"'."\n" : '';
我试图将其更改为 false 或 0 或 1 或 true 或 GET OVER HERE,但更改将不起作用:( 此选项不在 js 文件中,它们在 PHP 文件中,未随我的页面加载,或我的技能太低了。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)