Skip to content

Commit

Permalink
fix: 重载video时出错
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelckc committed Jan 24, 2023
1 parent 2b11518 commit 54b5851
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/views/Robot/video.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import flvjs from "flv.js";
import { getLiveStreamUrlApi } from "@/api";
import { reactive, ref, watch } from "vue";
const props = defineProps<{
Expand Down Expand Up @@ -39,8 +38,8 @@ const initPlayer = () => {
{
enableWorker: false, // 不启用拆散线程
enableStashBuffer: false, // 敞开IO暗藏缓冲区
reuseRedirectedURL: true, // 重用301/302重定向url,用于随后的申请,如查找、从新连贯等
autoCleanupSourceBuffer: true // 主动革除缓存
reuseRedirectedURL: true, // 重用301/302重定向url,用于随后的申请,如查找、重新连接等
autoCleanupSourceBuffer: false // 主动清除缓存
}
);
flvPlayer.attachMediaElement(videoElement.value);
Expand All @@ -58,7 +57,7 @@ const initPlayer = () => {
});
flvPlayer.on(flvjs.Events.MEDIA_INFO, (data: any) => {
console.log("MEDIA_INFO", data);
console.log("获取到媒体信息", data);
});
}
Expand All @@ -77,11 +76,12 @@ const destroyPlayer = () => {
flvPlayer.unload();
flvPlayer.detachMediaElement();
flvPlayer.destroy();
flvPlayer = null;
flvPlayer = {};
}
};
watch(props, async () => {
Object.keys(flvPlayer).length && destroyPlayer();
initPlayer();
});
Expand Down

0 comments on commit 54b5851

Please sign in to comment.