Преглед изворни кода

替换播放器为LivePlayer

Administrator пре 5 година
родитељ
комит
7a2357fb29

Разлика између датотеке није приказан због своје велике величине
+ 229 - 652
package-lock.json


+ 3 - 4
package.json

@@ -7,19 +7,18 @@
     "build": "vue-cli-service build"
   },
   "dependencies": {
+    "@liveqing/liveplayer": "^1.9.4",
     "axios": "^0.19.2",
     "core-js": "^2.6.5",
     "echarts": "^4.7.0",
     "element-ui": "^2.13.1",
-    "videojs-flash": "^2.2.1",
     "vue": "^2.6.10",
-    "vue-router": "^3.1.6",
-    "vue-video-player": "^5.0.2"
+    "vue-router": "^3.1.6"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "^3.8.0",
     "@vue/cli-service": "^3.8.0",
-    "video.js": "^5.6.0",
+    "copy-webpack-plugin": "^5.1.1",
     "vue-template-compiler": "^2.6.10"
   }
 }

+ 4 - 0
public/video/crossdomain.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<cross-domain-policy> 
+	<allow-access-from domain="*"/>  
+</cross-domain-policy> 

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
public/video/liveplayer-element.min.js


BIN
public/video/liveplayer.swf


+ 22 - 0
public/video/video.html

@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html>
+    <head>
+        <title>liveplayer</title>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+        <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
+        <script type="text/javascript" src="liveplayer-element.min.js"></script>
+		<script type="text/javascript">
+			window.onbeforeunload=function(e){     
+			  console.log("page close");
+			} 
+		</script>
+    </head>
+    <body>
+       <!-- <live-player id="player01" video-url="rtmp://live.hkstv.hk.lxdns.com/live/hks" live="true" stretch="true">
+            <div style="position:absolute;left:15px;top:15px;color:#FFF;">自定义叠加层</div>
+        </live-player> -->
+        <!-- <live-player video-url="http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8" live="false" stretch="true"></live-player> -->
+		<live-player id="player01" video-url="rtmp://218.59.173.214/rtp/0BEBC202" live="true" stretch="true" show-custom-button="false">
+    </body>
+</html>

BIN
src/assets/play.png


+ 30 - 7
src/components/videoList.vue

@@ -8,27 +8,31 @@
 		</div>
 		<div class="videoList">
 			<div class="video-item" v-for="(item, index) in videoList">
-				<video class="video-js vjs-default-skin vjs-big-play-centered" :id="genVideoId(index, item)" style="width: 15rem; height: 10rem;" controls>
-					<!-- <source src="rtmp://218.59.173.214/rtp/0BEBC202" type="rtmp/flv"> -->
-				</video>
+				<!-- <video class="video-js vjs-default-skin vjs-big-play-centered" :id="genVideoId(index, item)" style="width: 15rem; height: 10rem;" controls>
+				</video> -->
+				<img src="../assets/play.png" @click="showVideo()"/>
 				<div class="video-item-title">
 					{{ item.stream }}
 					<el-button icon="el-icon-search" circle size="mini" style="float: right;" @click="showVideoInfo(item)"></el-button>
 				</div>
 			</div>
 		</div>
+		
+		<el-dialog title="视频播放" :visible.sync="showVideoDialog" :destroy-on-close="true">
+			<iframe src="/video/video.html" style="width:100%; height:35rem;" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>
+		</el-dialog>
 	</div>
 </template>
 
 <script>
-import 'video.js/dist/video-js.css';
-import videojs from 'video.js';
-import 'videojs-flash';
 export default {
 	name: 'app',
-	components: {},
+	components: {
+	},
 	data() {
 		return {
+			videoUrl: '',
+			showVideoDialog:false,
 			videoList: [],
 			videoComponentList: []
 		};
@@ -84,6 +88,9 @@ export default {
 			this.$alert(msg, '视频信息', {
 				confirmButtonText: '确定'
 			});
+		},
+		showVideo:function(streamInfo){
+			this.showVideoDialog=true;
 		}
 	}
 };
@@ -96,13 +103,29 @@ export default {
 	align-content: flex-start;
 }
 .video-item {
+	position: relative;
 	width: 15rem;
+	height: 10rem;
 	margin-right: 1rem;
+	background-color: #000000;
+}
+.video-item img {
+	position: absolute;
+	top: 0;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	margin: auto;
+	width: 3rem;
+	height: 3rem;
 }
 .video-item-title {
+	position: absolute;
+	bottom: 0;
 	color: #000000;
 	background-color: #ffffff;
 	line-height: 1.5rem;
 	padding: 0.3rem;
+	width: 14.4rem;
 }
 </style>

+ 1 - 3
src/main.js

@@ -11,9 +11,7 @@ Vue.use(ElementUI);
 Vue.prototype.$global = global;
 Vue.prototype.$axios = axios;
 
-import Video from 'video.js'
-import 'video.js/dist/video-js.css'
-Vue.prototype.$video = Video
+
 
 new Vue({
 	router: router,

Неке датотеке нису приказане због велике количине промена