Commit 7a3e0652 authored by xiabin's avatar xiabin

修改视频自适应

parent f267b57c
...@@ -35,11 +35,4 @@ $this->registerJs($js); ...@@ -35,11 +35,4 @@ $this->registerJs($js);
</div> </div>
<div class="xs-show-bg"></div> <div class="xs-show-bg"></div>
<script type='text/javascript'>
$(function () {
var wVideo = $('.video-detail-info').width();
$('#my-video-play').css('width',wVideo);
})
</script>
<div class="copyright">© 2016 c.pp.cc 皖ICP备13046642号</div> <div class="copyright">© 2016 c.pp.cc 皖ICP备13046642号</div>
cGnhDtidLEiMVuZg
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</div> </div>
</div> </div>
<div class="video-main"> <div v-show="videoShow" class="video-main">
<video id="my-video-play" class="video-js vjs-default-skin vjs-big-play-centered" <video id="my-video-play" class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="auto"> controls preload="auto">
<source :src="coursewareInfo.videoUrl" type="video/mp4"/> <source :src="coursewareInfo.videoUrl" type="video/mp4"/>
...@@ -108,8 +108,6 @@ ...@@ -108,8 +108,6 @@
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
...@@ -127,7 +125,8 @@ ...@@ -127,7 +125,8 @@
weixinCheckHandler: false, weixinCheckHandler: false,
reload: false, reload: false,
isMobile: false, isMobile: false,
isWeixin: false isWeixin: false,
videoShow: false
} }
}, },
watch: { watch: {
...@@ -245,20 +244,27 @@ ...@@ -245,20 +244,27 @@
}, },
components: {}, components: {},
ready(){ ready(){
var self = this;
this.isMobile = this.coursewareInfo.isMobile; this.isMobile = this.coursewareInfo.isMobile;
this.isWeixin = Utils.isWeixin(); this.isWeixin = Utils.isWeixin();
videojs("my-video-play", { videojs("my-video-play", {
"controls": true, "controls": true,
"autoplay": false, "autoplay": false,
"language": "zh-CN", "language": "zh-CN",
"width": 640,
"height": 264,
poster: this.coursewareInfo.previewUrl poster: this.coursewareInfo.previewUrl
}).ready(function () { }).ready(function () {
var myPlayer = this; var myPlayer = this;
var rate = 9 / 16;
// EXAMPLE: Start playing the video. $('#my-video-play').css('width', '100%');
// myPlayer.play(); var wVideo = $('.video-detail-info').width();
var hVideo = wVideo * rate;
$('#my-video-play').css('height', hVideo);
window.onresize = function () {
var wVideo = $('.video-detail-info').width();
var hVideo = wVideo * rate;
$('#my-video-play').css('height', hVideo);
};
self.videoShow = true;
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment