详细问题描述 视频api中videoContext 对象,注册组件后访问videoContext所有方法无效 [内容] 把Video用uni.createVideoContext创建后,把它组注册成组件后,组件里调用的所有videoContext对象方法都无效
文明路最靓的崽 (作者)
class="multi-item rate"
@tap="switchRate"
>
{{ 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