Commit 429817b8c4937b1601fe7e824e81bbe3c965d367

Authored by panlinlin
1 parent d3d48d1d

修复分享功能

web_src/src/components/dialog/devicePlayer.vue
@@ -14,15 +14,27 @@ @@ -14,15 +14,27 @@
14 </div> 14 </div>
15 <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;"> 15 <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
16 <span style="width: 5rem; line-height: 2.5rem; text-align: right;">播放地址:</span> 16 <span style="width: 5rem; line-height: 2.5rem; text-align: right;">播放地址:</span>
17 - <el-input v-model="getPlayerShared.sharedUrl" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedUrl)"></el-input> 17 + <el-input v-model="getPlayerShared.sharedUrl" :disabled="true" >
  18 + <template slot="append">
  19 + <i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="getPlayerShared.sharedUrl" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
  20 + </template>
  21 + </el-input>
18 </div> 22 </div>
19 <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;"> 23 <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
20 <span style="width: 5rem; line-height: 2.5rem; text-align: right;">iframe:</span> 24 <span style="width: 5rem; line-height: 2.5rem; text-align: right;">iframe:</span>
21 - <el-input v-model="getPlayerShared.sharedIframe" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedIframe)"></el-input> 25 + <el-input v-model="getPlayerShared.sharedIframe" :disabled="true" >
  26 + <template slot="append">
  27 + <i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="getPlayerShared.sharedIframe" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
  28 + </template>
  29 + </el-input>
22 </div> 30 </div>
23 <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;"> 31 <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
24 <span style="width: 5rem; line-height: 2.5rem; text-align: right;">资源地址:</span> 32 <span style="width: 5rem; line-height: 2.5rem; text-align: right;">资源地址:</span>
25 - <el-input v-model="getPlayerShared.sharedRtmp" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedRtmp)"></el-input> 33 + <el-input v-model="getPlayerShared.sharedRtmp" :disabled="true" >
  34 + <template slot="append">
  35 + <i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="getPlayerShared.sharedRtmp" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
  36 + </template>
  37 + </el-input>
26 </div> 38 </div>
27 </el-tab-pane> 39 </el-tab-pane>
28 <!--{"code":0,"data":{"paths":["22-29-30.mp4"],"rootPath":"/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug/www/record/hls/kkkkk/2020-05-11/"}}--> 40 <!--{"code":0,"data":{"paths":["22-29-30.mp4"],"rootPath":"/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug/www/record/hls/kkkkk/2020-05-11/"}}-->
@@ -148,9 +160,10 @@ export default { @@ -148,9 +160,10 @@ export default {
148 }, 160 },
149 computed: { 161 computed: {
150 getPlayerShared: function () { 162 getPlayerShared: function () {
  163 +
151 return { 164 return {
152 - sharedUrl: window.location.host + '/' + this.videoUrl,  
153 - sharedIframe: '<iframe src="' + window.location.host + '/' + this.videoUrl + '"></iframe>', 165 + sharedUrl: window.location.origin + '/#/play/wasm/' + encodeURIComponent(this.videoUrl),
  166 + sharedIframe: '<iframe src="' + window.location.origin + '/#/play/wasm/' + encodeURIComponent(this.videoUrl) + '"></iframe>',
154 sharedRtmp: this.videoUrl 167 sharedRtmp: this.videoUrl
155 }; 168 };
156 } 169 }
web_src/src/components/dialog/easyPlayer.vue
@@ -14,10 +14,14 @@ export default { @@ -14,10 +14,14 @@ export default {
14 }, 14 },
15 props: ['videoUrl', 'error', 'hasaudio'], 15 props: ['videoUrl', 'error', 'hasaudio'],
16 mounted () { 16 mounted () {
  17 + let paramUrl = decodeURIComponent(this.$route.params.url)
17 this.$nextTick(() =>{ 18 this.$nextTick(() =>{
18 - console.log("初始化时的地址为: " + this.videoUrl)  
19 - this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)  
20 - this.easyPlayer.play(this.videoUrl, 1) 19 + if (typeof (this.videoUrl) == "undefined") {
  20 + this.videoUrl = paramUrl;
  21 + }
  22 + console.log("初始化时的地址为: " + this.videoUrl)
  23 + this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)
  24 + this.easyPlayer.play(this.videoUrl, 1)
21 }) 25 })
22 }, 26 },
23 watch:{ 27 watch:{
web_src/src/components/dialog/rtcPlayer.vue
@@ -17,9 +17,13 @@ export default { @@ -17,9 +17,13 @@ export default {
17 }, 17 },
18 props: ['videoUrl', 'error', 'hasaudio'], 18 props: ['videoUrl', 'error', 'hasaudio'],
19 mounted () { 19 mounted () {
  20 + let paramUrl = decodeURIComponent(this.$route.params.url)
20 this.$nextTick(() =>{ 21 this.$nextTick(() =>{
21 - console.log("初始化时的地址为: " + this.videoUrl)  
22 - this.play(this.videoUrl) 22 + if (typeof (this.videoUrl) == "undefined") {
  23 + this.videoUrl = paramUrl;
  24 + }
  25 + console.log("初始化时的地址为: " + this.videoUrl)
  26 + this.play(this.videoUrl)
23 }) 27 })
24 }, 28 },
25 watch:{ 29 watch:{
@@ -60,7 +64,7 @@ export default { @@ -60,7 +64,7 @@ export default {
60 this.webrtcPlayer.close(); 64 this.webrtcPlayer.close();
61 this.play(url) 65 this.play(url)
62 }, 100) 66 }, 100)
63 - 67 +
64 } 68 }
65 }); 69 });
66 70
@@ -69,14 +73,14 @@ export default { @@ -69,14 +73,14 @@ export default {
69 // document.getElementById('selfVideo').srcObject=s; 73 // document.getElementById('selfVideo').srcObject=s;
70 this.eventcallbacK("LOCAL STREAM", "获取到了本地流") 74 this.eventcallbacK("LOCAL STREAM", "获取到了本地流")
71 }); 75 });
72 - 76 +
73 }, 77 },
74 pause: function () { 78 pause: function () {
75 if (this.webrtcPlayer != null) { 79 if (this.webrtcPlayer != null) {
76 this.webrtcPlayer.close(); 80 this.webrtcPlayer.close();
77 this.webrtcPlayer = null; 81 this.webrtcPlayer = null;
78 } 82 }
79 - 83 +
80 }, 84 },
81 eventcallbacK: function(type, message) { 85 eventcallbacK: function(type, message) {
82 console.log("player 事件回调") 86 console.log("player 事件回调")
@@ -106,5 +110,5 @@ export default { @@ -106,5 +110,5 @@ export default {
106 /* .iconqingxiLOGO { 110 /* .iconqingxiLOGO {
107 display: none !important; 111 display: none !important;
108 } */ 112 } */
109 -  
110 -</style>  
111 \ No newline at end of file 113 \ No newline at end of file
  114 +
  115 +</style>
web_src/src/router/index.js
@@ -14,6 +14,9 @@ import web from &#39;../components/setting/Web.vue&#39; @@ -14,6 +14,9 @@ import web from &#39;../components/setting/Web.vue&#39;
14 import sip from '../components/setting/Sip.vue' 14 import sip from '../components/setting/Sip.vue'
15 import media from '../components/setting/Media.vue' 15 import media from '../components/setting/Media.vue'
16 16
  17 +import wasmPlayer from '../components/dialog/easyPlayer.vue'
  18 +import rtcPlayer from '../components/dialog/rtcPlayer.vue'
  19 +
17 const originalPush = VueRouter.prototype.push 20 const originalPush = VueRouter.prototype.push
18 VueRouter.prototype.push = function push(location) { 21 VueRouter.prototype.push = function push(location) {
19 return originalPush.call(this, location).catch(err => err) 22 return originalPush.call(this, location).catch(err => err)
@@ -81,5 +84,10 @@ export default new VueRouter({ @@ -81,5 +84,10 @@ export default new VueRouter({
81 name: 'test', 84 name: 'test',
82 component: test, 85 component: test,
83 }, 86 },
  87 + {
  88 + path: '/play/rtc/:url',
  89 + name: 'rtcPlayer',
  90 + component: rtcPlayer,
  91 + },
84 ] 92 ]
85 }) 93 })