Commit 9d9fbd96bfe04233aa54e8b963838bd283565619

Authored by zhiyangdu
1 parent de894d03

video播放

src/pages/index/index.less
... ... @@ -38,11 +38,6 @@
38 38 height: 806px;
39 39 background: #bd3325 url("../../../static/img/index/3.jpg") no-repeat center top;
40 40 background-size: 100%;
41   - .video_box{
42   - width: 713px !important;
43   - height: 401px !important;
44   - margin: 85px 18px 0 18px;
45   - }
46 41 }
47 42 div:nth-child(4){
48 43 width: 100%;
... ... @@ -129,11 +124,9 @@
129 124 background: #bd3325 url("../../../static/img/index/17.jpg") no-repeat center top;
130 125 background-size: 100%;
131 126 }
132   -}
133   -// 设置播放器的背景颜色
134   -.vjs-poster{
135   - background-color: transparent !important;
136   - //.vjs-poster{
137   - // background-color: transparent;
138   - //}
  127 + .video_box{
  128 + width: 713px !important;
  129 + height: 404px !important;
  130 + margin: 85px 18px 0 18px;
  131 + }
139 132 }
... ...
src/pages/index/index.vue
... ... @@ -38,9 +38,18 @@
38 38 <div></div>
39 39  
40 40 <div></div>
41   -
42   - <div></div>
43 41 <!--视频-->
  42 + <div>
  43 + <div class="video_box">
  44 + <video-player class="video-player vjs-custom-skin" @play="onPlayerPlay($event)"
  45 + ref="videoPlayer"
  46 + :playsinline="playsinline"
  47 + :options="playerOptions"
  48 + x5-playsinline
  49 + webkit-playsinline>
  50 + </video-player>
  51 + </div>
  52 + </div>
44 53 <div></div>
45 54  
46 55 <div></div>
... ... @@ -79,7 +88,10 @@
79 88 },
80 89 aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
81 90 fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
82   - sources: [],
  91 + sources: [{
  92 + type: "video/mp4",
  93 + src: "https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm"
  94 + }],
83 95 hls: true, // 启用hls?
84 96 poster: '../../../static/img/index/video1.png', // 你的封面地址
85 97 width: document.documentElement.clientWidth || document.body.clientWidth,
... ...