亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - vue是影片播放的問題?
給我你的懷抱
給我你的懷抱 2017-05-19 10:36:26
0
1
998

一個影片播放元件,從父元件接收影片url,點(diǎn)擊播放按鈕的時(shí)候把這個url給video標(biāo)籤的src。出現(xiàn)報(bào)錯資訊說沒這個資源,好像是這個意思,但是審查元素,發(fā)現(xiàn)video標(biāo)籤的src屬性已經(jīng)有了想要的視屏位址。下面是我的程式碼:

<template>
  <p id="vedioComponent">
    <video id="vdo" webkit-playsinline playsinline controls v-show="isVdoShow" :src="reciveVideoUrl"></video>
    <img id="poster" v-show="isPosterShow" :src="posterUrl" alt="">
    <img id="loading" v-show="isLoadingShow" src="https://hybrid.xiaoying.tv/web/active/krFAQ/static/imgs/load.gif" alt="">
    <img @click="play()" id="playBtn" v-show="isPlayBtnShow" src="https://hybrid.xiaoying.tv/web/active/krFAQ/static/imgs/playBtn.png" alt="">
  </p>
</template>

<script>
export default {
  props: [ 'videoUrl', 'posterUrl' ],
  data () {
    return {
      isVdoShow: false,
      isPosterShow: true,
      isLoadingShow: false,
      isPlayBtnShow: true,
      reciveVideoUrl: ''
    }
  },
  mounted () {
    //  給視頻容器設(shè)置高
    var screenW = window.screen.width
    document.getElementById('vedioComponent').style.height = screenW + 'px'
    //  添加可播放事件
    var vdo = document.getElementById('vdo')
    vdo.addEventListener('canplay', function () {
      console.log(1)
      this.isVdoShow = true
      this.isLoadingShow = false
      this.isPosterShow = false
    })
  },
  methods: {
    //  點(diǎn)擊播放按鈕播放視屏
    play: function () {
      this.reciveVideoUrl = this.videoUrl             //  獲取視頻url
      var vdo = document.getElementById('vdo')
      vdo.play()
      this.isLoadingShow = true
      this.isPlayBtnShow = false
    }
  }
}
</script>

這裡是報(bào)錯訊息:Uncaught (in promise) DOMException: The element has no supported sources.

#請問這是什麼原因

給我你的懷抱
給我你的懷抱

全部回覆(1)
我想大聲告訴你

video中直接綁定videoUrl

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板