55 lines
962 B
Vue
55 lines
962 B
Vue
<template>
|
|
<view class="mysss">
|
|
|
|
<!--#ifdef H5-->
|
|
<view class="video-js" ref="video">
|
|
</view>
|
|
<!-- #endif -->
|
|
|
|
|
|
<!--#ifdef APP-PLUS-->
|
|
<video
|
|
class="my_video"
|
|
object-fit="fill"
|
|
:src="src"
|
|
controls></video>
|
|
<!-- #endif -->
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
//
|
|
export default {
|
|
props: {
|
|
src: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
|
|
};
|
|
},
|
|
mounted() {
|
|
// #ifdef H5
|
|
var video = document.createElement('video')
|
|
video.id = 'video'
|
|
video.style = 'width: 100%;height: 150px;'
|
|
video.controls = true
|
|
var source = document.createElement('source')
|
|
source.src = this.src
|
|
video.appendChild(source)
|
|
this.$refs.video.$el.appendChild(video)
|
|
videojs('video')
|
|
// #endif
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.my_video {
|
|
width: 100%;
|
|
}
|
|
</style>
|