提交 d6d40b41 作者: 翁进城

fix: 机库清流无法观看

上级 7ab243d8
<template> <template>
<div class="qingliu" id="qinglliu" ref="qingliu"> <div class="qingliu">
<div :id="'qingliu_' + name" class="qingcanvas" ref="qingcanvas"> <div ref="player_area"></div>
</div>
</div> </div>
</template> </template>
<script> <script>
import {
dataURLToBlob,
canvasToDataURL,
} from "../../../../../../../../../../../../utils/image-tool";
export default { export default {
name: "QingLiuPlayer", name: "QingLiuPlayer",
props: { props: {
url: { data: Object,
type: String, raw_msg: Number,
default: '' infoflag: Boolean,
}
}, },
data() { data() {
return { return {
name: "QingLiuPlayer" + Date.now(), name: "QingLiuPlayer" + Date.now(),
}; };
}, },
watch: { created() {
window.addEventListener("message", this.onDebugInfo);
}, },
created() {},
mounted() { mounted() {
console.log(this.raw_msg, "raw_msg");
this.init(); this.init();
}, },
beforeDestroy() { beforeDestroy() {
window.kbt_player_destroy("qingliu_" + this.name); window.kbt_player_destroy(this.name);
window.removeEventListener("resize", this.handResize); window.removeEventListener("message", this.onDebugInfo);
}, },
methods: { methods: {
/** /**
* 初始化 * 初始化
*/ */
init() { init() {
// 新 window.kbt_sdk_load().then(() => {
window.kbt_sdk_load(this.url, "qingliu_" + this.name); let parentObj = this.$refs.player_area;
window.kbt_player_create(
// 监听窗口大小变化事件 this.name,
window.addEventListener("resize", this.handResize); this.data.vUrl,
/* var canvas_qinliu = document.getElementById("qingliu_" + this.name); 970,
var resizeObserver = new ResizeObserver((e) => { 545,
for (let i of e) { parentObj
window.kbt_player_resize("qingliu_" + this.name); );
}
}); });
resizeObserver.observe(canvas_qinliu); */
}, },
handResize() { screenShot() {
// 获取 Canvas 元素 var canvas = document.querySelector("#sdk_canvas_" + this.name);
var canvas_qinliu = document.getElementById("qingliu_" + this.name); const image = canvasToDataURL(canvas);
// 获取 Canvas 的初始宽度和高度 let blob = dataURLToBlob(image);
var initialWidth = canvas_qinliu.width; return blob;
var initialHeight = canvas_qinliu.height; },
// 获取当前 Canvas 的宽度和高度 fullScreen() {
var currentWidth = canvas_qinliu.clientWidth; // var canvas = document.querySelector("#sdk_canvas_" + this.name);
var currentHeight = canvas_qinliu.clientHeight; var canvas = this.$refs.player_area.querySelector("canvas");
// 检查 Canvas 的大小是否发生变化 canvas && canvas.requestFullscreen();
if (currentWidth !== initialWidth || currentHeight !== initialHeight) {
// 执行适应新尺寸的操作
window.kbt_player_resize("qingliu_" + this.name);
}
}, },
fullScreen(flag) { onDebugInfo(e) {
if (flag) { switch (e.type) {
let dom = document.querySelector("#qingliu_" + this.name); case "qoeinfo":
dom.requestFullscreen(); case "raw_msg":
} else { this.$emit("debugInfo", e);
document.exitFullscreen(); break;
} }
}, },
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang='scss'>
.qingliu ::v-deep { .qingliu {
width: 100%; width: 100%;
height: 200px; height: 100%;
.qingcanvas { .player_area {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.cf {
canvas { position: fixed;
top: 0;
left: 0;
padding: 10px;
color: #fff;
background: rgba($color: #000000, $alpha: 0.6);
}
canvas::v-deep {
width: 100% !important; width: 100% !important;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<span class="label">{{ label }}</span> <span class="label">{{ label }}</span>
<!-- <div class="el-icon-close close" @click="close"></div> --> <!-- <div class="el-icon-close close" @click="close"></div> -->
</div> </div>
<components :is="playerCom" ref="player" :url="url" :className="'fkLivePlayer'" v-if="showPlayer" /> <components :is="playerCom" ref="player" :url="url" v-if="showPlayer" />
<div class="iconfont icon-gengxin video-reset" v-hover @click="reset"></div> <div class="iconfont icon-gengxin video-reset" v-hover @click="reset"></div>
<slot></slot> <slot></slot>
</div> </div>
......
<template> <template>
<div> <div>
<Player ref="player" @close="$emit('close')" :url="selectUrl" :name="name" :label="label" /> <Player ref="player" @close="$emit('close')" :url="selectUrl" :name="name" :label="label" style="height: 200px;" />
<el-select v-model="selectUrl" class="select" popper-class="mmc"> <el-select v-model="selectUrl" class="select" popper-class="mmc">
<el-option <el-option
v-for="item in streamOptions" v-for="item in streamOptions"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论