wangguoyu 5 months ago
parent
commit
7e95679d33
3 changed files with 27 additions and 9 deletions
  1. 1 3
      index.html
  2. 3 2
      manifest.json
  3. 23 4
      pages/study/lookShipin.vue

+ 1 - 3
index.html

@@ -2,8 +2,6 @@
 <html lang="en">
 	<head>
 		<meta charset="UTF-8" />
-		    <link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.9.6/skins/default/aliplayer-min.css" />
-		    <script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/de/prismplayer/2.9.6/aliplayer-min.js"></script>
 		<script src="https://g.alicdn.com/AWSC/AWSC/awsc.js"></script>
 		<script>
 			var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
@@ -20,4 +18,4 @@
 		<div id="app"><!--app-html--></div>
 		<script type="module" src="/main.js"></script>
 	</body>
-</html> 
+</html>

+ 3 - 2
manifest.json

@@ -1,6 +1,6 @@
 {
     "name" : "鹅状元",
-    "appid" : "__UNI__CB9D85D",
+    "appid" : "__UNI__5135820",
     "description" : "",
     "versionName" : "1.0.0",
     "versionCode" : 1,
@@ -24,7 +24,8 @@
         },
         /* 模块配置 */
         "modules" : {
-            "VideoPlayer" : {}
+            "VideoPlayer" : {},
+            "LivePusher" : {}
         },
         /* 应用发布信息 */
         "distribute" : {

+ 23 - 4
pages/study/lookShipin.vue

@@ -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,