c_zihan@qq.com
c_zihan@qq.com
  • 发布:2020-02-19 11:28
  • 更新:2020-03-05 20:40
  • 阅读:443

【报Bug】video组件在iOS系统静音后不能重新开启声音

分类:nvue

如题

HbuilderX 2.5.1.20200103
使用Hello uni-app演示项目修改即可

---------- video.nvue

<template>  
    <div>  
        <video id='video1' class="video" :src="src" autoplay="false" duration="" controls="true" :danmu-list="list"  
            danmu-btn="true" enable-danmu="true" :loop="true" :muted="muted" initial-time="" direction="-90"  
            show-mute-btn="true" @play="onstart" @pause="onpause" @ended="onfinish" @error="onfail" @waiting="waiting"  
            @timeupdate="timeupdate" @fullscreenchange="fullscreenchange"></video>  

        <button class="btn" @click="setMute">开启/关闭声音</button>  

        <button class="btn" @click="play">播放</button>  
        <button class="btn" @click="pause">暂停</button>  
        <button class="btn" @click="seek">跳转到指定位置</button>  
        <button class="btn" @click="stop">停止</button>  
        <button class="btn" @click="fullScreen">全屏</button>  
        <button class="btn" @click="exitFullScreen">退出全屏</button>  
        <button class="btn" @click="playbackRate">设置倍速</button>  
        <button class="btn" @click="sendDanmu">发送弹幕</button>  

    </div>  
</template>  

<script>  
    export default {  
        data: {  
            src: "https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20181126.mp4",  
            fil: true,  
            list: [{  
                text: '要显示的sdfa本',  
                color: '#FF0000',  
                time: 9  
            }],  
            muted: false  
        },  
        onReady() {  
            this.context = uni.createVideoContext("video1", this);  
            // #ifdef APP-PLUS-NVUE  
            console.log('nvue');  
            // #endif  
        },  
        methods: {  
            onstart(e) {  
                console.log("onstart:" + JSON.stringify(e));  
            },  
            onpause(e) {  
                console.log("onpause:" + JSON.stringify(e));  
            },  
            onfinish(e) {  
                console.log("onfinish:" + JSON.stringify(e));  
            },  
            onfail(e) {  
                console.log("onfail:" + JSON.stringify(e));  
            },  
            fullscreenchange(e) {  
                console.log("fullscreenchange:" + JSON.stringify(e));  
            },  
            waiting(e) {  
                console.log("waiting:" + JSON.stringify(e));  
            },  
            timeupdate(e) {  
                console.log("timeupdate:" + JSON.stringify(e));  
            },  

            play() {  
                this.context.play();  
            },  
            pause() {  
                this.context.pause();  
            },  
            seek() {  
                this.context.seek(20);  
            },  
            stop() {  
                this.context.stop();  
            },  
            fullScreen() {  
                this.context.requestFullScreen({  
                    direction: 90  
                });  
            },  
            exitFullScreen() {  
                this.context.exitFullScreen();  
            },  
            sendDanmu() {  
                this.context.sendDanmu({  
                    text: '要显示的弹幕文本',  
                    color: '#FF0000'  
                });  
            },  
            playbackRate() {  
                this.context.playbackRate(2);  
            },  
            setMute() {  
              this.muted = !this.muted  
              console.log('this.muted', this.muted);  
            }  
        }  
    }  
</script>  

<style>  
    .video {  
        width: 750rpx;  
        height: 400rpx;  
        background-color: #808080;  
    }  

    .btn {  
        margin-top: 5px;  
        margin-bottom: 5px;  
        ;  
    }  
</style>

测试手机
iPhone6

2020-02-19 11:28 负责人:无 分享
已邀请:
DCloud_IOS_CLP

DCloud_IOS_CLP

已经修复,请更新到HBuilderX2.6.3+版本

  • nizuidaeji@126.com

    HB 2.8.6.20200814 依然ANDROID系统静音后不能重新开启声音

    2020-08-20 22:01

要回复问题请先登录注册