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
    }
    }
    }

     

  • 相关阅读:
    hash
    C#执行Sql事务处理
    数据库的锁表
    页面的刷新 和图片的替换
    单点登录 Webservice
    js 动态调用js文件
    .net生成EXCEL
    JS : 连续滚动
    引用指定类型的对象
    对象序列化为字符串
  • 原文地址:https://www.cnblogs.com/xue-wejie/p/10431500.html
Copyright © 2011-2022 走看看