Commit 26e2d111 by Tianqing Liu

feat: 增加背景图片展示

1 parent d41aa782
......@@ -3,6 +3,7 @@
:data-player-type="this.playerType"
:class="containerClassName"
>
<div v-if="previewStyles" class="vion-player-preview" :style="previewStyles"></div>
</div>
</template>
......@@ -31,6 +32,7 @@ export default {
type: Boolean,
default: true,
},
// 是否回放。true 表示直播回放
isPlayback: {
type: Boolean,
default: false,
......@@ -40,6 +42,11 @@ export default {
type: Boolean,
default: false,
},
// 预览图片地址
previewUrl: {
type: String,
default: '',
},
},
data() {
return {
......@@ -64,6 +71,13 @@ export default {
// if (this.playerType === 'playback') list.push('playback-status');
return list;
},
previewStyles() {
if (this.previewUrl) {
return `background-image: url(${this.previewUrl});`
} else {
return null;
}
},
},
mounted() {
this.init(this.playUrl);
......@@ -304,4 +318,10 @@ export default {
display: none !important;
}
}
.vion-player-preview {
height: 100%;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
}
</style>
......@@ -6,6 +6,7 @@
ref="vionPlayer"
:datetime-range="datetimeRange"
watermarkText="文安智能678"
preview-url="https://www.smartliu.top:2443/blog/themeauthor.jpg"
@ptz-control="handlePtz"
@rate-change="handleRateChange"
/>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!