文明路最靓的崽
文明路最靓的崽
  • 发布:2019-10-31 20:25
  • 更新:2019-11-01 10:54
  • 阅读:1307

【报Bug】视频api中videoContext 对象,注册组件后访问videoContext所有方法无效

分类:uni-app

详细问题描述

视频api中videoContext 对象,注册组件后访问videoContext所有方法无效

[内容]

把Video用uni.createVideoContext创建后,把它组注册成组件后,组件里调用的所有videoContext对象方法都无效

2019-10-31 20:25 负责人:无 分享
已邀请:
陈晨1

陈晨1

你的组件写法有问题吧,代码发一下

  • 文明路最靓的崽 (作者)


    <template>

    <view>

    <video class="video" id="myVideo" :src="videoUri" controls v-if="videoUri">

    <cover-view class="video-control">

    <cover-view class="multi rate" @tap="showSwitchRate">x {{ currentRate }}</cover-view>

    </cover-view>

    <cover-view class="multi-list rate" :class="{ active: rateShow }">

    <cover-view

    v-for="(item, index) in ['0.5', '0.8', '1.0', '1.25', '1.5']"

    key="index"
    class="multi-item rate"

    data-rate="item"
    @tap="switchRate"

    class="{ active: item == currentRate }"
    >

    {{ item }}

    </cover-view>

    </cover-view>

    </video>

    </view>

    </template>


    <script>

    export default {

    name: 'SyVideo',

    data() {

    return {

    videoContext: uni.createVideoContext('myVideo'),

    rateShow: false,

    currentRate: 1.0

    };

    },

    onReady: function(res) {

    let that = this;

    that.videoContext = uni.createVideoContext('myVideo');

    },

    created() {

    console.log(this.videoUri);

    },

    methods: {

    showSwitchRate(rate) {

    let that = this;

    console.log('rateShow');

    that.rateShow = true;

    },

    switchRate(e) {

    let that = this;

    let rate = Number(e.currentTarget.dataset.rate);

    that.currentRate = rate;

    that.rateShow = false;

    this.videoContext.playbackRate(rate);

    }

    },

    props: {

    videoUri: {

    type: [String],

    default: ''

    }

    }

    };

    </script>

    2019-11-01 17:00

该问题目前已经被锁定, 无法添加新回复