video组件已经非常强大了;
m3u8高清流畅;
mp4支持软/硬解;
mp4小视频播放自动缓存,流畅无缝重复播放;
最新版支持自定义Header;
m3u8/mp4等格式可以通过plus.downloader.createDownload实现缓存下载;
可以满足99.9%的视频播放需求!!!
但是video的不足之处;
播放本地m3u8视频能力不足.
示例:
<template>
<view class="">
<video v-if="src" :src="src" controls @error="err"></video>
<!-- 可以正常播放 -->
<button type="default" @tap="setStr('_www/static/1.m3u8')">本地未加密本地地址</button>
<!-- 不能正常播放 -->
<button type="default" @tap="setStr('_www/static/2.m3u8')">本地未加密网络地址</button>
<!-- 不能正常播放 -->
<button type="default" @tap="setStr('_www/static/encrypt/index.m3u8')">本地加密本地地址</button>
</view>
</template>
<script>
export default {
data() {
return {
src: ''
};
},
onLoad() {
},
methods: {
setStr(src){
this.src = 'file://' + plus.io.convertLocalFileSystemURL(src);
console.log(this.src);
},
err(e) {
console.log(e);
},
}
};
</script>
<style>
</style>