uni-app video组件在播放flv直播流文件时 android端加载即报错

uni-app video组件在播放flv直播流文件时 android端加载即报错

bug描述:

在模拟器上正常, 在真机上加载直接报error

示例代码:

<video id="myVideo" :style="{ height: windowHeight + 'px' }" style="width: 100%;" src="zhibo.content" autoplay="true" controls="false" page-gesture="false" poster="zhibo.pic" enable-progress-gesture="false" [@error](/user/error)="videoErrorCallback"></video>

更多关于uni-app video组件在播放flv直播流文件时 android端加载即报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html

5 回复

你给视频权限了么

更多关于uni-app video组件在播放flv直播流文件时 android端加载即报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html


能正常播放的也会出现一加载就报error的情况

你给个完整的示例。我试试

<template> <view class="shipinpic" v-else> <image :src="bgpic" :style="{ height: windowHeight + 'px' }" style="width: 100%;"></image> <view class="txt"><text>直播已结束</text></view> <view class="guanzhu"><text>关注</text></view> <view class="backzb" @click="goback()"><text>返回首页</text></view> </view> </template> <script> export default { data() { return { zhiboInfo: {}, windowHeight: 0, isshow: true, zhiboId:0, time: 0, timer:null, bgpic: "../../static/image/bg1.png" }; }, onLoad(e) { this.zhiboId = e.id; this.loadData(e.id); }, mounted: function (res) { var that = this; uni.getSystemInfo({ success: function (res) { that.windowHeight = res.windowHeight; } }); }, methods: { loadData(zhiboId) { this.$u.get('zhibo/detail', {zhiboId: zhiboId}).then(res => { if(res.data) { this.zhiboInfo = res.data; if(res.data.status == 0) { this.isshow = false; } }else{ this.$U.output('直播数据请求失败!'); } }); this.timer =setInterval(() => { this.time++; }, 1000); }, videoErrorCallback: function(e) { if(this.time > 5) { if (this.timer) clearInterval(this.timer); this.timer = null; this.time = 0; this.isshow = false; } } } }; </script> <style> template,page{background: #000000;} .shipinpic{width: 100%;} .txt{position:absolute;left: 300upx;top: 10%;color: #FFFFFF;z-index: 999;width: 200upx;text-align: center;} .guanzhu{position:absolute;left: 300upx;top: 50%;color: #F29100;z-index: 999;background: #FFFFFF;font-weight: bold;width: 200upx;height:60upx;border-radius: 22upx;text-align: center;line-height: 60upx;} .backzb{position:absolute;left: 300upx;bottom:5%;color: #FFFFFF;width: 200upx;height: 60upx;border-radius: 22upx;border: 1px solid #FFFFFF;text-align: center;font-weight: bold;line-height: 60upx;} </style>

我用了笨办法, 加了一个定时器, 判断超过5秒之后再出现error再判断为真正的加载失败

回到顶部