|
@@ -14,8 +14,25 @@
|
|
|
} from '@dcloudio/uni-app';
|
|
|
import {
|
|
|
ref,
|
|
|
+ onMounted,
|
|
|
reactive
|
|
|
} from "vue"
|
|
|
+ const loadWebPlayerSDK = async () => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const s_tag = document.createElement('script'); // 引入播放器js
|
|
|
+ s_tag.type = 'text/javascript';
|
|
|
+ s_tag.src = 'https://g.alicdn.com/de/prismplayer/2.9.6/aliplayer-min.js';
|
|
|
+ s_tag.charset = 'utf-8';
|
|
|
+ s_tag.onload = () => {
|
|
|
+ resolve();
|
|
|
+ }
|
|
|
+ document.body.appendChild(s_tag);
|
|
|
+ const l_tag = document.createElement('link'); // 引入播放器css
|
|
|
+ l_tag.rel = 'stylesheet';
|
|
|
+ l_tag.href = 'https://g.alicdn.com/de/prismplayer/2.9.6/skins/default/aliplayer-min.css';
|
|
|
+ document.body.appendChild(l_tag);
|
|
|
+ });
|
|
|
+ }
|
|
|
let videoUrl = 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4'
|
|
|
let pageData = reactive({
|
|
|
type: '',
|
|
@@ -27,14 +44,16 @@
|
|
|
signature: '',
|
|
|
playauth: '',
|
|
|
})
|
|
|
-
|
|
|
onReady(() => {
|
|
|
- getPlayAuth()
|
|
|
+
|
|
|
}),
|
|
|
onLoad(() => {
|
|
|
-
|
|
|
+ loadWebPlayerSDK().then(() => {
|
|
|
+ getPlayAuth()
|
|
|
+ }).catch((e) => {
|
|
|
+ console.log("加载播放器SDK失败", e);
|
|
|
+ });
|
|
|
})
|
|
|
-
|
|
|
// function getVideoId(){
|
|
|
// let req ={
|
|
|
// fileName:videoUrl,
|