From 1ef360a14efab8a1defa1dfdc13bb5af64a9d621 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Mon, 18 Sep 2023 17:02:51 +0800
Subject: [PATCH] 飞行指令打开

---
 src/components/Jessibuca/Jessibuca.vue |   51 +++++++++++++++++++++++++--------------------------
 1 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/src/components/Jessibuca/Jessibuca.vue b/src/components/Jessibuca/Jessibuca.vue
index fd69ac0..dd383e2 100644
--- a/src/components/Jessibuca/Jessibuca.vue
+++ b/src/components/Jessibuca/Jessibuca.vue
@@ -1,33 +1,31 @@
 <template>
-    <div>
-        <div class="root">
-            <div class="container-shell">
-                <div class="container-shell-title">jessibuca demo player</div>
-                <div id="container" ref="container"></div>
-                <div class="input">
-                    <div>输入URL:</div>
-                    <input type="input" autocomplete="on" :value="playUrl" />
-                    <button v-if="!playing" @click="play">播放</button>
-                    <button v-else @click="pause">停止</button>
-                </div>
-                <div class="input" v-if="loaded">
-                    <button @click="destroy">销毁</button>
-                </div>
-            </div>
-        </div>
-    </div>
+    <div id="container" ref="container" :style="{width,height}"></div>
 </template>
 
 <script setup lang="ts">
-import { onMounted, onUnmounted, ref } from 'vue'
-import Jessibuca from '../../../types/jessibuca'
-let jessibuca :null | Jessibuca = null
+import { onMounted, onUnmounted, ref, defineProps } from 'vue'
+import Jessibuca from '../../../public/jessibuca/jessibuca'
+const props = defineProps({
+  videoUrl: {
+    type: String,
+    required: true
+  },
+  width: {
+    type: String,
+    default: '300px'
+  },
+  height: {
+    type: String,
+    default: '200px'
+  }
+})
+let jessibuca: null | Jessibuca = null
 const container = ref(null)
 const buffer = ref(null)
 const showBandwidth = ref(false)
-const showOperateBtns = ref(false)
+const showOperateBtns = ref(true)
 const forceNoOffscreen = ref(false)
-const playUrl = ref('http://flv.bdplay.nodemedia.cn/live/bbb.flv')
+// const playUrl = ref()
 const playing = ref(false)
 const quieting = ref(true)
 const loaded = ref(false)
@@ -103,7 +101,7 @@
   })
 
   jessibuca.on('error', function (error: any) {
-    console.log('error', error)
+    console.error('error', error)
   })
 
   jessibuca.on('timeout', function () {
@@ -150,13 +148,14 @@
 }
 onMounted(() => {
   createJessibuca()
+  play()
 })
 onUnmounted(() => {
   jessibuca && jessibuca.destroy()
 })
 const play = () => {
-  if (playUrl.value) {
-    jessibuca?.play(playUrl.value)
+  if (props.videoUrl) {
+    jessibuca?.play(props.videoUrl)
   }
 }
 const pause = () => {
@@ -174,4 +173,4 @@
 }
 </script>
 
-<style scoped></style>
+<style scoped lang="scss"></style>

--
Gitblit v1.9.3