修改播放器

This commit is contained in:
RenCheng 2025-06-13 16:00:55 +08:00
parent f7b277d496
commit 164f620594

View File

@ -24,13 +24,11 @@
:class="['video-container', { 'unsupported': !isFormatSupported }]"
>
<video
v-if="isFormatSupported && !forceVideoJS"
v-if="isFormatSupported"
ref="html5Player"
class="video-js"
controls
></video>
<div v-else-if="isFormatSupported" ref="videoPlayer"></div>
<!-- 不支持的格式提示 -->
<div v-if="!isFormatSupported" class="unsupported-message">
<p>不支持 {{ ext.toUpperCase() }} 格式播放</p>
@ -113,28 +111,7 @@ import '@videojs/http-streaming';
if (!this.isFormatSupported) return;
this.$nextTick(() => {
// HTML5
if (!this.forceVideoJS) {
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');
}
);
this.$refs.html5Player.src = this.src;
});
},
disposePlayer() {