diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue index 6d91da9a..32051013 100644 --- a/web_src/src/components/dialog/devicePlayer.vue +++ b/web_src/src/components/dialog/devicePlayer.vue @@ -14,15 +14,27 @@
播放地址: - + + +
iframe: - + + +
资源地址: - + + +
@@ -148,9 +160,10 @@ export default { }, computed: { getPlayerShared: function () { + return { - sharedUrl: window.location.host + '/' + this.videoUrl, - sharedIframe: '', + sharedUrl: window.location.origin + '/#/play/wasm/' + encodeURIComponent(this.videoUrl), + sharedIframe: '', sharedRtmp: this.videoUrl }; } diff --git a/web_src/src/components/dialog/easyPlayer.vue b/web_src/src/components/dialog/easyPlayer.vue index 71d858e5..c79f65d7 100644 --- a/web_src/src/components/dialog/easyPlayer.vue +++ b/web_src/src/components/dialog/easyPlayer.vue @@ -14,10 +14,14 @@ export default { }, props: ['videoUrl', 'error', 'hasaudio'], mounted () { + let paramUrl = decodeURIComponent(this.$route.params.url) this.$nextTick(() =>{ - console.log("初始化时的地址为: " + this.videoUrl) - this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK) - this.easyPlayer.play(this.videoUrl, 1) + if (typeof (this.videoUrl) == "undefined") { + this.videoUrl = paramUrl; + } + console.log("初始化时的地址为: " + this.videoUrl) + this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK) + this.easyPlayer.play(this.videoUrl, 1) }) }, watch:{ diff --git a/web_src/src/components/dialog/rtcPlayer.vue b/web_src/src/components/dialog/rtcPlayer.vue index a7c02124..75c18f33 100644 --- a/web_src/src/components/dialog/rtcPlayer.vue +++ b/web_src/src/components/dialog/rtcPlayer.vue @@ -17,9 +17,13 @@ export default { }, props: ['videoUrl', 'error', 'hasaudio'], mounted () { + let paramUrl = decodeURIComponent(this.$route.params.url) this.$nextTick(() =>{ - console.log("初始化时的地址为: " + this.videoUrl) - this.play(this.videoUrl) + if (typeof (this.videoUrl) == "undefined") { + this.videoUrl = paramUrl; + } + console.log("初始化时的地址为: " + this.videoUrl) + this.play(this.videoUrl) }) }, watch:{ @@ -60,7 +64,7 @@ export default { this.webrtcPlayer.close(); this.play(url) }, 100) - + } }); @@ -69,14 +73,14 @@ export default { // document.getElementById('selfVideo').srcObject=s; this.eventcallbacK("LOCAL STREAM", "获取到了本地流") }); - + }, pause: function () { if (this.webrtcPlayer != null) { this.webrtcPlayer.close(); this.webrtcPlayer = null; } - + }, eventcallbacK: function(type, message) { console.log("player 事件回调") @@ -106,5 +110,5 @@ export default { /* .iconqingxiLOGO { display: none !important; } */ - - \ No newline at end of file + + diff --git a/web_src/src/router/index.js b/web_src/src/router/index.js index a56ce99d..8035f8bd 100644 --- a/web_src/src/router/index.js +++ b/web_src/src/router/index.js @@ -14,6 +14,9 @@ import web from '../components/setting/Web.vue' import sip from '../components/setting/Sip.vue' import media from '../components/setting/Media.vue' +import wasmPlayer from '../components/dialog/easyPlayer.vue' +import rtcPlayer from '../components/dialog/rtcPlayer.vue' + const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) @@ -81,5 +84,10 @@ export default new VueRouter({ name: 'test', component: test, }, + { + path: '/play/rtc/:url', + name: 'rtcPlayer', + component: rtcPlayer, + }, ] })