zoukankan      html  css  js  c++  java
  • 微信小程序(mpvue)—解决视频播放bug的一种方式

    // 第一页

    <div @click="play(video.src, video.width, video.height)"></div>

    methods: {

      play (src, width, height) {

        this.$router.push({path: `/pages/playVideo?src=${src}&width=${width}&height=${height}`})

      }

    }

    // 第二页

    <div class="video-box">
    <video class="video"
      :style="{ width, height: height}"
    id="video"
    :src="src"
    show-play-btn
    controls
    autoplay="true"
    objectFit="cover"
    :show-fullscreen-btn="fullscreenShow"
    custom-cache="false"
    ></video>
    </div>
    export default {
    data () {
    return {
    '100%',
    height: '100%',
    src: '',
    fullscreenShow: false,
    videoObj: wx.createVideoContext('video')
        }
    },
    onLoad () {
    this.src = this.$route.query.src
        const width = this.$route.query.width
    const height = this.$route.query.height
    if (width > height) {
    const radio = width / wx.getSystemInfoSync().windowWidth
    this.width = width / radio + 'px'
    this.height = height / radio + 'px'
    this.fullscreenShow = true
    } else {
    this.fullscreenShow = false
    }
    }
    }

     

  • 相关阅读:
    二叉树
    基础1
    tcp/udp
    异步io模块(自定义)
    select+异步
    异步发送请求的几种方式
    多线程,进程实现并发请求
    位解包运算
    从前端程序员的视角看小程序的稳定性保障
    运行node 报错 throw er; // Unhandled 'error' event
  • 原文地址:https://www.cnblogs.com/xue-wejie/p/10431500.html
Copyright © 2011-2022 走看看