videoPlay.vue 1.51 KB
Newer Older
1
<template>
xulili's avatar
xulili committed
2 3
  <div>
    <!--
4 5 6 7
      <video :src="videoSrc" :poster="videoImg" :autoplay="playStatus" height="421" width="700" :muted="muteStatus">
        your browser does not support the video tag
      </video>
      <button @click="playClick" :class="{hide: isPlay}">点击播放</button> -->
xulili's avatar
xulili committed
8 9 10 11 12 13 14 15 16 17 18 19 20
    <!--class="video-js vjs-default-skin vjs-big-play-centered" -->
    <video
      :preload="preload"
      :poster="videoImg"
      :height="height"
      :width="width"
      align="center"
      :controls="controls"
      :autoplay="autoplay"
    >
      <source :src="videoSrc" type="video/mp4" />
    </video>
  </div>
21 22 23 24
</template>

<script>
export default {
xulili's avatar
xulili committed
25 26
  name: "Video",
  data() {
27
    return {
xulili's avatar
xulili committed
28 29 30 31 32
      videoSrc:
        "https://video.pearvideo.com/mp4/short/20200209/cont-1650197-14888002-hd.mp4",
      videoImg: "https://sm.ms/image/ueRFCZfk2xTONGb",
      playStatus: "",
      muteStatus: "",
33 34
      isMute: true,
      isPlay: false,
xulili's avatar
xulili committed
35 36 37
      width: "820", // 设置视频播放器的显示宽度(以像素为单位)
      height: "500", // 设置视频播放器的显示高度(以像素为单位)
      preload: "auto", //  建议浏览器是否应在<video>加载元素后立即开始下载视频数据。
38
      controls: true, // 确定播放器是否具有用户可以与之交互的控件。没有控件,启动视频播放的唯一方法是使用autoplay属性或通过Player API。
xulili's avatar
xulili committed
39 40 41
      autoplay: "",
    };
  },
42 43 44

  // 自动播放属性,muted:静音播放
  // autoplay: 'muted',
xulili's avatar
xulili committed
45
};
46 47 48 49
</script>

<style scoped >
</style>