|
@@ -0,0 +1,72 @@
|
|
|
|
|
+<script>
|
|
|
|
|
+import Player from "@/utils/Player";
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: "SmallVideo",
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ playerInstance: null,
|
|
|
|
|
+ width: 0,
|
|
|
|
|
+ height: 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ async mounted() {
|
|
|
|
|
+ this.playerInstance = new Player();
|
|
|
|
|
+ this.$nextTick( async() => {
|
|
|
|
|
+ await this.playerInstance.loadPlayerScript();
|
|
|
|
|
+ this.playerInstance.loadPlayer();
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.playerInstance.play();
|
|
|
|
|
+ }, 1000)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const smallVideo = document.querySelector(".small-video");
|
|
|
|
|
+ this.width = smallVideo.clientWidth;
|
|
|
|
|
+ this.height = smallVideo.clientHeight;
|
|
|
|
|
+ console.log("playerInstance", this.playerInstance)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="small-video">
|
|
|
|
|
+ <div class="video-container"
|
|
|
|
|
+ :style="{'--width': width + 'px', '--height': height + 'px'}"
|
|
|
|
|
+ :id="playerInstance?.playerId"></div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="mask-box">
|
|
|
|
|
+
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+
|
|
|
|
|
+.small-video {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.video-container {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ //background: pink;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/deep/ .plv-player-container {
|
|
|
|
|
+ width: var(--width);
|
|
|
|
|
+ height: var(--height);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.mask-box {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ bottom: 0;
|
|
|
|
|
+ left: 0;
|
|
|
|
|
+ right: 0;
|
|
|
|
|
+ background: transparent;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+</style>
|