修改播放器
This commit is contained in:
parent
f7b277d496
commit
164f620594
|
@ -24,13 +24,11 @@
|
||||||
:class="['video-container', { 'unsupported': !isFormatSupported }]"
|
:class="['video-container', { 'unsupported': !isFormatSupported }]"
|
||||||
>
|
>
|
||||||
<video
|
<video
|
||||||
v-if="isFormatSupported && !forceVideoJS"
|
v-if="isFormatSupported"
|
||||||
ref="html5Player"
|
ref="html5Player"
|
||||||
class="video-js"
|
class="video-js"
|
||||||
controls
|
controls
|
||||||
></video>
|
></video>
|
||||||
<div v-else-if="isFormatSupported" ref="videoPlayer"></div>
|
|
||||||
|
|
||||||
<!-- 不支持的格式提示 -->
|
<!-- 不支持的格式提示 -->
|
||||||
<div v-if="!isFormatSupported" class="unsupported-message">
|
<div v-if="!isFormatSupported" class="unsupported-message">
|
||||||
<p>不支持 {{ ext.toUpperCase() }} 格式播放</p>
|
<p>不支持 {{ ext.toUpperCase() }} 格式播放</p>
|
||||||
|
@ -113,28 +111,7 @@ import '@videojs/http-streaming';
|
||||||
if (!this.isFormatSupported) return;
|
if (!this.isFormatSupported) return;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
// HTML5原生视频
|
|
||||||
if (!this.forceVideoJS) {
|
|
||||||
this.$refs.html5Player.src = this.src;
|
this.$refs.html5Player.src = this.src;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//使用Video.js处理特殊格式
|
|
||||||
this.player = videojs(
|
|
||||||
this.$refs.videoPlayer,
|
|
||||||
{
|
|
||||||
controls: true,
|
|
||||||
autoplay: false,
|
|
||||||
sources: [{
|
|
||||||
src: this.src,
|
|
||||||
type: this.getVideoType()
|
|
||||||
}],
|
|
||||||
techOrder: ['html5', 'flash'] // 尝试使用Flash后备方案
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
console.log('Player ready');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
disposePlayer() {
|
disposePlayer() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user