|
@@ -50,7 +50,23 @@ const config = reactive({
|
|
|
WCS: true
|
|
WCS: true
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const playCreate = () => {
|
|
|
|
|
|
|
+// 动态加载 EasyPlayer
|
|
|
|
|
+function loadEasyPlayer() {
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ if (window.EasyPlayerPro) {
|
|
|
|
|
+ resolve(window.EasyPlayerPro)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const script = document.createElement('script')
|
|
|
|
|
+ script.src = '/js/EasyPlayer/EasyPlayer-pro.js'
|
|
|
|
|
+ script.onload = () => resolve(window.EasyPlayerPro)
|
|
|
|
|
+ script.onerror = reject
|
|
|
|
|
+ document.head.appendChild(script)
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const playCreate = async () => {
|
|
|
const container = easyPlayerRef.value
|
|
const container = easyPlayerRef.value
|
|
|
if (!container) return
|
|
if (!container) return
|
|
|
|
|
|
|
@@ -106,7 +122,8 @@ const playCreate = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 播放视频
|
|
// 播放视频
|
|
|
-function play(url) {
|
|
|
|
|
|
|
+async function play(url) {
|
|
|
|
|
+ await loadEasyPlayer()
|
|
|
const uid = route.params._uid || Date.now()
|
|
const uid = route.params._uid || Date.now()
|
|
|
|
|
|
|
|
// 确保容器已准备就绪
|
|
// 确保容器已准备就绪
|