Javascript 移动safari上的消防功能“;“完成”;按钮单击+;移动Witia视频
我正在使用Wista在我的网站中嵌入视频。这适用于所有常规浏览器,但在mobile safari中,单击“播放”按钮可以打开html5视频播放器。正因为如此,我的exitVideo功能从未被激活,因为播放器有自己的“完成”按钮。有人知道如何捕捉这个点击事件吗?我真正需要的是一个函数,当用户关闭视频时,该函数将Javascript 移动safari上的消防功能“;“完成”;按钮单击+;移动Witia视频,javascript,html5-video,mobile-safari,wistia,Javascript,Html5 Video,Mobile Safari,Wistia,我正在使用Wista在我的网站中嵌入视频。这适用于所有常规浏览器,但在mobile safari中,单击“播放”按钮可以打开html5视频播放器。正因为如此,我的exitVideo功能从未被激活,因为播放器有自己的“完成”按钮。有人知道如何捕捉这个点击事件吗?我真正需要的是一个函数,当用户关闭视频时,该函数将fullScreenVideo.playingVideo变为false html 我们很乐意告诉你我们的情况。 查看我们的介绍视频 Javascript var fullScreenVi
fullScreenVideo.playingVideo
变为false
html
我们很乐意告诉你我们的情况。
查看我们的介绍视频
Javascript
var fullScreenVideo = fullScreenVideo || {};
fullScreenVideo = {
name: 'fullScreenVideo',
backgroundvideo: '8hq5abfi3l',
backgroundVideoDiv: document.getElementById("wistia_8hq5abfi3l"),
overlayVideo: '7j06z458qu',
overlayVideoDiv: document.getElementById("wistia_7j06z458qu"),
textDiv: document.getElementById("play-btn"),
movieBackground: document.getElementById("movie-background"),
movieSection: document.getElementById('movie-section'),
videoContainer: document.getElementById("video_container"),
ex: document.getElementById('ex'),
playingVideo: false,
width: null,
height: null,
embedVideo: function()
{
var videoOptions = {};
Wistia.obj.merge(videoOptions, {
plugin: {
cropFill: {
src: "//fast.wistia.com/labs/crop-fill/plugin.js"
}
}
});
wistiaEmbed = Wistia.embed(fullScreenVideo.backgroundvideo, videoOptions);
overlayEmbed = Wistia.embed(fullScreenVideo.overlayVideo, videoOptions);
/**
* We load the thumbnail in the background while we wait
* for the video to load and play. Once loaded, we pause, reset to
* frame zero, show the video then play it.
*/
wistiaEmbed.bind("play", function(){
wistiaEmbed.pause();
wistiaEmbed.time(0);
fullScreenVideo.backgroundVideoDiv.style.visibility='visible';
wistiaEmbed.play();
return this.unbind;
});
},
playVideo: function()
{
fullScreenVideo.playingVideo = true;
if(window.innerWidth < 650 && Modernizr.orientation){
overlayEmbed.play();
} else {
fullScreenVideo.movieBackground.setAttribute('style', 'visibility: visible;');
fullScreenVideo.movieSection.setAttribute('style', 'width: '+fullScreenVideo.width+'px; height: '+fullScreenVideo.height+'px;');
fullScreenVideo.overlayVideoDiv.setAttribute('style', 'left: 0px; visibility: visible;');
fullScreenVideo.ex.setAttribute('style', 'right: 24px');
fullScreenVideo.textDiv.style.opacity='0';
overlayEmbed.plugin.cropFill.resize();
overlayEmbed.play();
fullScreenVideo.disableScroll();
}
overlayEmbed.bind("end", function () {
fullScreenVideo.exitVideo();
});
},
exitVideo: function()
{
fullScreenVideo.playingVideo = false;
fullScreenVideo.movieBackground.setAttribute('style', 'visibility: hidden;');
fullScreenVideo.movieSection.setAttribute('style', 'width: '+fullScreenVideo.width+'px; height: 320px;');
fullScreenVideo.overlayVideoDiv.setAttribute('style', 'left: -3000px; visibility: hidden;');
fullScreenVideo.ex.setAttribute('style', 'right: -3000px');
fullScreenVideo.textDiv.style.opacity='1';
overlayEmbed.pause();
overlayEmbed._keyBindingsActive = false;
overlayEmbed.time(0);
fullScreenVideo.enableScroll();
fullScreenVideo.fixTextPosition();
},
fixTextPosition: function()
{
var width = document.documentElement.clientWidth;
var height = window.innerHeight;
if(fullScreenVideo.playingVideo === true ){ //&& window.innerWidth > 650) {
overlayEmbed.plugin.cropFill.resize();
fullScreenVideo.videoContainer.setAttribute('style', 'width: '+width+'px; height: '+height+'px;');
fullScreenVideo.movieSection.setAttribute('style', 'width: '+width+'px; height: '+height+'px;');
} else{
fullScreenVideo.movieSection.setAttribute('style', 'width: '+width+'px;');
fullScreenVideo.videoContainer.setAttribute('style', 'width: '+width+'px;');
};
fullScreenVideo.overlayVideoDiv.style.width=width+'px';
fullScreenVideo.overlayVideoDiv.style.height=height+'px';
fullScreenVideo.width = width;
fullScreenVideo.height = height;
},
disableScroll: function() {
document.body.style.overflow='hidden';
},
enableScroll: function() {
document.body.style.overflow='auto';
}
}
xui.ready(function() {
fullScreenVideo.fixTextPosition();
fullScreenVideo.embedVideo();
});
window.addEventListener('resize', fullScreenVideo.fixTextPosition);
x$("#play-btn").on('click', fullScreenVideo.playVideo);
x$("#ex").on('click', fullScreenVideo.exitVideo);
var fullScreenVideo=fullScreenVideo | |{};
全屏视频={
名称:'fullScreenVideo',
背景视频:“8hq5abfi3l”,
背景视频div:document.getElementById(“wistia_8hq5abfi3l”),
覆盖视频:“7j06z458qu”,
overlayVideoDiv:document.getElementById(“wistia_7j06z458qu”),
textDiv:document.getElementById(“播放btn”),
movieBackground:document.getElementById(“电影背景”),
movieSection:document.getElementById('movie-section'),
videoContainer:document.getElementById(“视频容器”),
ex:document.getElementById('ex'),
播放视频:错误,
宽度:空,
高度:空,
嵌入视频:函数()
{
var videoOptions={};
Wistia.obj.merge(视频选项{
插件:{
cropFill:{
src://fast.wistia.com/labs/crop-fill/plugin.js
}
}
});
wistiaEmbed=Wistia.embed(fullScreenVideo.backgroundvideo,videoOptions);
overlayEmbed=Wistia.embed(fullScreenVideo.overlayVideo,videoOptions);
/**
*我们在等待时在后台加载缩略图
*用于加载和播放视频。加载后,我们暂停,重置为
*第0帧,显示视频,然后播放。
*/
绑定(“play”,function()){
暂停();
时间(0);
fullScreenVideo.backgroundVideoDiv.style.visibility='visible';
wistia.play();
返回此文件。取消绑定;
});
},
播放视频:函数()
{
fullScreenVideo.playingVideo=true;
if(窗内宽度<650和现代化方向){
覆盖嵌入。play();
}否则{
fullScreenVideo.movieBackground.setAttribute('style','visibility:visible;');
fullScreenVideo.movieSection.setAttribute('style','width:'+fullScreenVideo.width+'px;height:'+fullScreenVideo.height+'px;');
fullScreenVideo.overlayVideoDiv.setAttribute('style','left:0px;visibility:visible;');
fullScreenVideo.ex.setAttribute('style','right:24px');
fullScreenVideo.textDiv.style.opacity='0';
overlayEmbed.plugin.cropFill.resize();
覆盖嵌入。play();
fullScreenVideo.disableScroll();
}
绑定(“结束”,函数(){
fullScreenVideo.exitVideo();
});
},
exitVideo:函数()
{
fullScreenVideo.playingVideo=假;
fullScreenVideo.movieBackground.setAttribute('style','visibility:hidden;');
fullScreenVideo.movieSection.setAttribute('style','width:'+fullScreenVideo.width+'px;height:320px;');
fullScreenVideo.overlayVideoDiv.setAttribute('style','left:-3000px;可见性:hidden;');
fullScreenVideo.ex.setAttribute('style','right:-3000px');
fullScreenVideo.textDiv.style.opacity='1';
overlayEmbed.pause();
覆盖嵌入。_keyBindingsActive=false;
覆盖嵌入时间(0);
fullScreenVideo.enableScroll();
fullScreenVideo.fixtPosition();
},
fixTextPosition:函数()
{
var width=document.documentElement.clientWidth;
var height=window.innerHeight;
如果(fullScreenVideo.playingVideo==true){/&&window.innerWidth>650){
overlayEmbed.plugin.cropFill.resize();
fullScreenVideo.videoContainer.setAttribute('style','width:'+width+'px;height:'+height+'px;');
fullScreenVideo.movieSection.setAttribute('style','width:'+width+'px;height:'+height+'px;');
}否则{
fullScreenVideo.movieSection.setAttribute('style','width:'+width+'px;');
fullScreenVideo.videoContainer.setAttribute('style','width:'+width+'px;');
};
fullScreenVideo.overlayVideoDiv.style.width=width+'px';
fullScreenVideo.overlayVideoDiv.style.height=height+'px';
fullScreenVideo.width=宽度;
fullScreenVideo.height=高度;
},
disableScroll:函数(){
document.body.style.overflow='hidden';
},
enableScroll:function(){
document.body.style.overflow='auto';
}
}
ready(函数(){
fullScreenVideo.fixtPosition();
fullScreenVideo.embeddevideo();
});
window.addEventListener('resize',fullScreenVideo.fixTextPosition);
x$(“#播放btn”)。在('click',fullScreenVideo.playVideo)上;
在('click',fullScreenVideo.exitVideo)上的x$(“#ex”);
var fullScreenVideo = fullScreenVideo || {};
fullScreenVideo = {
name: 'fullScreenVideo',
backgroundvideo: '8hq5abfi3l',
backgroundVideoDiv: document.getElementById("wistia_8hq5abfi3l"),
overlayVideo: '7j06z458qu',
overlayVideoDiv: document.getElementById("wistia_7j06z458qu"),
textDiv: document.getElementById("play-btn"),
movieBackground: document.getElementById("movie-background"),
movieSection: document.getElementById('movie-section'),
videoContainer: document.getElementById("video_container"),
ex: document.getElementById('ex'),
playingVideo: false,
width: null,
height: null,
embedVideo: function()
{
var videoOptions = {};
Wistia.obj.merge(videoOptions, {
plugin: {
cropFill: {
src: "//fast.wistia.com/labs/crop-fill/plugin.js"
}
}
});
wistiaEmbed = Wistia.embed(fullScreenVideo.backgroundvideo, videoOptions);
overlayEmbed = Wistia.embed(fullScreenVideo.overlayVideo, videoOptions);
/**
* We load the thumbnail in the background while we wait
* for the video to load and play. Once loaded, we pause, reset to
* frame zero, show the video then play it.
*/
wistiaEmbed.bind("play", function(){
wistiaEmbed.pause();
wistiaEmbed.time(0);
fullScreenVideo.backgroundVideoDiv.style.visibility='visible';
wistiaEmbed.play();
return this.unbind;
});
},
playVideo: function()
{
fullScreenVideo.playingVideo = true;
if(window.innerWidth < 650 && Modernizr.orientation){
overlayEmbed.play();
} else {
fullScreenVideo.movieBackground.setAttribute('style', 'visibility: visible;');
fullScreenVideo.movieSection.setAttribute('style', 'width: '+fullScreenVideo.width+'px; height: '+fullScreenVideo.height+'px;');
fullScreenVideo.overlayVideoDiv.setAttribute('style', 'left: 0px; visibility: visible;');
fullScreenVideo.ex.setAttribute('style', 'right: 24px');
fullScreenVideo.textDiv.style.opacity='0';
overlayEmbed.plugin.cropFill.resize();
overlayEmbed.play();
fullScreenVideo.disableScroll();
}
overlayEmbed.bind("end", function () {
fullScreenVideo.exitVideo();
});
},
exitVideo: function()
{
fullScreenVideo.playingVideo = false;
fullScreenVideo.movieBackground.setAttribute('style', 'visibility: hidden;');
fullScreenVideo.movieSection.setAttribute('style', 'width: '+fullScreenVideo.width+'px; height: 320px;');
fullScreenVideo.overlayVideoDiv.setAttribute('style', 'left: -3000px; visibility: hidden;');
fullScreenVideo.ex.setAttribute('style', 'right: -3000px');
fullScreenVideo.textDiv.style.opacity='1';
overlayEmbed.pause();
overlayEmbed._keyBindingsActive = false;
overlayEmbed.time(0);
fullScreenVideo.enableScroll();
fullScreenVideo.fixTextPosition();
},
fixTextPosition: function()
{
var width = document.documentElement.clientWidth;
var height = window.innerHeight;
if(fullScreenVideo.playingVideo === true ){ //&& window.innerWidth > 650) {
overlayEmbed.plugin.cropFill.resize();
fullScreenVideo.videoContainer.setAttribute('style', 'width: '+width+'px; height: '+height+'px;');
fullScreenVideo.movieSection.setAttribute('style', 'width: '+width+'px; height: '+height+'px;');
} else{
fullScreenVideo.movieSection.setAttribute('style', 'width: '+width+'px;');
fullScreenVideo.videoContainer.setAttribute('style', 'width: '+width+'px;');
};
fullScreenVideo.overlayVideoDiv.style.width=width+'px';
fullScreenVideo.overlayVideoDiv.style.height=height+'px';
fullScreenVideo.width = width;
fullScreenVideo.height = height;
},
disableScroll: function() {
document.body.style.overflow='hidden';
},
enableScroll: function() {
document.body.style.overflow='auto';
}
}
xui.ready(function() {
fullScreenVideo.fixTextPosition();
fullScreenVideo.embedVideo();
});
window.addEventListener('resize', fullScreenVideo.fixTextPosition);
x$("#play-btn").on('click', fullScreenVideo.playVideo);
x$("#ex").on('click', fullScreenVideo.exitVideo);