zuoxue 5 年之前
父節點
當前提交
32d0a19df8
共有 5 個文件被更改,包括 61 次插入6 次删除
  1. 22 0
      .gitignore
  2. 2 2
      global.js
  3. 31 3
      src/components/videoList.vue
  4. 5 0
      src/router/index.js
  5. 1 1
      vue.config.js

+ 22 - 0
.gitignore

@@ -0,0 +1,22 @@
+# Node rules:
+## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+## Dependency directory
+## Commenting this out is preferred by some people, see
+## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
+node_modules
+
+# Book build output
+_book
+
+# git push scripts
+zxPush
+zxPushDev
+zxPull
+
+# eBook build output
+*.epub
+*.mobi
+*.pdf
+.vsnode_modules/

+ 2 - 2
global.js

@@ -1,6 +1,6 @@
-const host = 'http://localhost/index/api';
+const host = 'http://172.16.63.208/index/api';
 const secret = '035c73f7-bb6b-4889-a715-d9eb2d1925cc';
-const baseMediaUrl='ws://localhost/';
+const baseMediaUrl='ws://172.16.63.208/';
 function genApiUrl(method){
 	return host+method+"?secret="+secret;
 }

+ 31 - 3
src/components/videoList.vue

@@ -29,7 +29,8 @@
 			></iframe>
 			<div id="shared" style="text-align: right;">
 				<div style="margin-bottom: 0.5rem;">
-					<!-- <el-button type="primary" size="small" @click="startRecord()">录制</el-button> -->
+					<el-button type="primary" size="small" @click="startRecord()">录制</el-button>
+					<el-button type="primary" size="small" @click="stopRecord()">停止录制</el-button>
 				</div>
 				<div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
 					<span style="width: 5rem; line-height: 2.5rem; text-align: right;">播放地址:</span>
@@ -77,7 +78,7 @@ export default {
 	},
 	mounted() {
 		this.initData();
-		this.updateLooper=setInterval(this.initData,3000);
+		this.updateLooper=setInterval(this.initData,10000);
 	},
 	destroyed() {
 		this.$destroy('videojs');
@@ -132,9 +133,11 @@ export default {
 		startRecord:function(){
 			let that = this;
 			let streamInfo=this.currentPlayerInfo;
+			let startURL=this.$global.genApiUrl('/startRecord') + '&type=0&vhost='+streamInfo.vhost+"&app="+streamInfo.app+"&stream="+streamInfo.stream+"&wait_for_record=1&continue_record=1";
+			console.log(startURL);
 			this.$axios({
 				method: 'get',
-				url: this.$global.genApiUrl('/startRecord') + '&type=0&vhost='+streamInfo.vhost+"&app="+streamInfo.app+"&stream="+streamInfo.stream+"&wait_for_record=1&continue_record=1&customized_path='/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug'"
+				url: startURL
 			}).then(function(res) {
 				console.log(JSON.stringify(res.data));
 				if (res.data.code == 0&&res.data.result) {
@@ -151,6 +154,31 @@ export default {
 					});
 				}
 			});
+		},
+		stopRecord:function(){
+			let that = this;
+			let streamInfo=this.currentPlayerInfo;
+			let stopURL=this.$global.genApiUrl('/stopRecord') + '&type=0&vhost='+streamInfo.vhost+"&app="+streamInfo.app+"&stream="+streamInfo.stream;
+			console.log(stopURL);
+			this.$axios({
+				method: 'get',
+				url: stopURL
+			}).then(function(res) {
+				console.log(JSON.stringify(res.data));
+				if (res.data.code == 0&&res.data.result) {
+					that.$message({
+						showClose: true,
+						message: '结束录制',
+						type: 'success'
+					});
+				}else{
+					that.$message({
+						showClose: true,
+						message: res.data.msg,
+						type: 'error'
+					});
+				}
+			});
 		}
 	}
 };

+ 5 - 0
src/router/index.js

@@ -3,6 +3,7 @@ import VueRouter from 'vue-router'
 
 import control from '../components/control.vue'
 import videoList from '../components/videoList.vue'
+import HelloWorld from '../components/HelloWorld.vue'
 Vue.use(VueRouter)
 
 export default new VueRouter({
@@ -15,5 +16,9 @@ export default new VueRouter({
 			path: '/videoList',
 			component: videoList,
 		},
+		{
+			path: '/zx',
+			component: HelloWorld,
+		},
 	]
 })

+ 1 - 1
vue.config.js

@@ -2,7 +2,7 @@ module.exports = {
   devServer: {
     proxy: {
       '/bpi': {                                //   以'/bpi'开头的请求会被代理进行转发
-        target: 'http://218.59.173.214:801/index/api',       //   要发向的后台服务器地址  如果后台服务跑在后台开发人员的机器上,就写成 `http://ip:port` 如 `http:192.168.12.213:8081`   ip为后台服务器的ip
+        target: 'http://172.16.63.208:801/index/api',       //   要发向的后台服务器地址  如果后台服务跑在后台开发人员的机器上,就写成 `http://ip:port` 如 `http:192.168.12.213:8081`   ip为后台服务器的ip
         changeOrigin: true                     
       }
     }