kkkkk 5 rokov pred
rodič
commit
164138a541
3 zmenil súbory, kde vykonal 15 pridanie a 11 odobranie
  1. 1 1
      global.js
  2. 2 2
      src/components/control.vue
  3. 12 8
      src/components/videoList.vue

+ 1 - 1
global.js

@@ -2,7 +2,7 @@ const host = 'http://218.59.173.214:801/index/api';
 const secret = '035c73f7-bb6b-4889-a715-d9eb2d1925cc';
 const baseMediaUrl='rtmp://218.59.173.214/';
 function genApiUrl(method){
-	return "/bpi"+method+"?secret="+secret;
+	return host+method+"?secret="+secret;
 }
 export default{
     host,

+ 2 - 2
src/components/control.vue

@@ -65,7 +65,7 @@ export default {
 			},
 			mChart: null,
 			mChart1: null,
-			chartInterval: 0,
+			chartInterval: 0,//更新图表统计图定时任务标识
 			allSessionData: [],
 			visible: false,
 			serverConfig: {}
@@ -77,7 +77,7 @@ export default {
 		this.chartInterval = setInterval(this.updateData, 3000);
 	},
 	destroyed() {
-		clearInterval(this.chartInterval);
+		clearInterval(this.chartInterval);//释放定时任务
 	},
 	methods: {
 		updateData: function() {

+ 12 - 8
src/components/videoList.vue

@@ -33,15 +33,17 @@ export default {
 			videoComponentList: []
 		};
 	},
-	created() {
+	mounted() {
 		this.getVideoList();
 	},
-	mounted() {},
 	destroyed() {
 		this.$destroy('videojs');
-		this.videoComponentList.forEach(item => {
-			// var player = videojs(item);
-			item.dispose();
+		//释放视频播放器空间
+		this.videoList.forEach(item => {
+			if(typeof item.video!='undefined'){
+				item.video.dispose();
+			}
+			clearTimeout(item.delay);
 		});
 	},
 	methods: {
@@ -53,12 +55,14 @@ export default {
 					src: that.$global.baseMediaUrl + stream.app + '/' + stream.stream
 				}
 			];
-			setTimeout(function() {
-				let player = videojs('video-' + position);
+			//延迟1s执行,给dom生成一定的时间
+			stream.delay=setTimeout(function() {
+				let player = videojs('video-' + position); 
 				player.ready(function() {
 					var obj = this;
 					obj.src(story_sources);
-					that.videoComponentList.push(player);
+					stream.video=player;
+					console.log(JSON.stringify(stream));
 				});
 			}, 1000);
 			return 'video-' + position;