微信小程序很简单,通过wx.previewMedia这个api实现,具体教程参考:https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html
var sources = [{
url: 'https://repo.bfw.wiki/bfwrepo/image/5d6539385ad28.png',
type: 'image'
},{
url: 'https://repo.bfw.wiki/bfwrepo/video/modushanghai.mp4',
type: 'video'
}]
var index = 0
var url = sources[index].url
wx.previewMedia({
sources: sources, // 需要预览的资源列表
current: index, // 当前显示的资源序号
url: url // 当前预览资源的url链接
})
但是抖音小程序没有这样的api,但是video标签已经支持播放视频了,还能旋转全屏,所有抖音那边觉得没有必要,就没弄这个api了。
<video src="//repo.bfw.wiki/bfwrepo/video/modushanghai.mp4"></video>
网友回复


