视频组件
<video :custom-cache="false" :src="item.voideoUrl" :id="'audio'+ index" :vslide-gesture-in-fullscreen="false" :direction='0' :enable-progress-gesture="false" :show-fullscreen-btn="false" loop object-fit="inherit"></video>
使用wx的jssdk,
var jweixin = require('jweixin-module');
var innerAudioContext;
创建视频实例对象,在sdk初始化完成后,调用 getNetworkType 权限,在成功后执行播放,就可以自动播放了
creatAudio() {
var that = this;
jweixin.config({}); // 不做任何签名验证都可以
jweixin.ready(function() {
if (innerAudioContext) innerAudioContext.pause();
innerAudioContext = uni.createVideoContext('audio' + that.index);
innerAudioContext.autoplay = true;
innerAudioContext.src = that.src;
innerAudioContext.play();
WeixinJSBridge.invoke('getNetworkType', {}, function(e) {
innerAudioContext.play();
})
})
},
jweixin-module
微信JS-SDK
安装
NPM
npm install jweixin-module --save
使用
var jweixin = require('jweixin-module')
jweixin.config({}); // 不做任何签名验证都可以
jweixin.ready(function(){
// TODO
});