Skip to content

Instantly share code, notes, and snippets.

@raiscui
Created March 13, 2020 06:55
Show Gist options
  • Save raiscui/4359694eed0dc216b0b7d0e6e62ef2af to your computer and use it in GitHub Desktop.
Save raiscui/4359694eed0dc216b0b7d0e6e62ef2af to your computer and use it in GitHub Desktop.
wp js
function MakePlayConctrl(){
played = false;
function autoPlayAudio(video) {
// var video = document.getElementById(id).getElementsByTagName("video")[0];
if (window.WeixinJSBridge) {
WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
played|| video.play().then(()=>{played=true});
}, false);
} else {
document.addEventListener("WeixinJSBridgeReady", function () {
WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
played|| video.play().then(()=>{played=true});
});
}, false);
}
played|| video.play().then(()=>{played=true});
return false;
};
return autoPlayAudio;
}
let playConctrl = MakePlayConctrl();
revapi16.bind("revolution.slide.layeraction",function (e,data) {
//data.eventtype - 图层动作(输入,进入舞台,离开舞台,离开舞台)
//data.layertype - 图层类型(图像,视频,html)
//data.layersettings - 图层的默认设置
//data.layer - 图层为jQuery对象
// console.log("===========================");
// console.log("lay> data.eventtype",data.eventtype);
// console.log("lay> data.layertype",data.layertype);
// console.log("lay> data.layersettings",data.layersettings);
// console.log("lay> data.layer",data.layer);
// console.log("===========================");
if (data.layertype == "video"){
var video = data.layer.find('video').get(0);
playConctrl(video);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment