video组件 在pc小程序和开发者工具中正常显示,但是在真机中,随着页面加载,视频列表中从第17个video开始,视频显示时长为0,且video组件中间播放按钮不显示
https://developers.weixin.qq.com/miniprogram/dev/component/video.html
请求地址:https://cn.myxsmanagement.top/wxApi/file?typeId=0&pageNum=1&pageSize=10
header token验证
Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyIiwiZXhwIjoxNTkxNzAyNjcxLCJpYXQiOjE1OTE3MDA4NzF9.NKH3DOYKHr1xlc_-OnNej-dvIN3l0vVaiNqj8L0hR4s
<view class="video-item grace-box-shadow" wx:for="{{list}}" wx:key="index">
<video src="{{item.uploadUrl}}" id="video{{index}}" data-id="{{index}}" loop controls show-progress show-center-play-btn play-btn-position="center" bindplay="StartPlay"></video>
<view class="video-title">{{item.fileName}}</view>
</view>
var fun = require('../../../../utils/fun.js');
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
list: [],
query: {
pageNum: 1,
pageSize: 10
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
l_loadData(this)
},
StartPlay: function(e) {
var ind = e.currentTarget.dataset.id
for (let i = 0; i < this.data.list.length; i++) {
if (i != ind) {
var v = "video" + i
this.videoContext = wx.createVideoContext(v)
this.videoContext.pause()
}
}
},
onReachBottom: function() {
getMore(this)
}
})
// 加载数据
function l_loadData(pg) {
var opts = {
values: {
typeId: 0,
pageNum: pg.data.query.pageNum,
pageSize: pg.data.query.pageSize,
},
url: app.globalData.urlPath + '/wxApi/file',
method: 'get'
};
fun.loadData(pg, opts).then(res => {
pg.data.query.pageNum=pg.data.query.pageNum+1
pg.setData({
list: res,
query:pg.data.query
})
})
}
function getMore(pg) {
var opts = {
values: {
typeId: 0,
pageNum: pg.data.query.pageNum,
pageSize: pg.data.query.pageSize,
},
url: app.globalData.urlPath + '/wxApi/file',
method: 'get'
};
fun.loadData(pg, opts).then(res => {
pg.data.list = pg.data.list.concat(res)
pg.data.query.pageNum = pg.data.query.pageNum + 1
pg.setData({
list: pg.data.list,
query: pg.data.query
})
})
}
你好,不建议同个页面使用多个video组件,建议不超过3个video,如果要实现video列表功能,请进行优化(image列表,选中时将image替换成video)。