You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
5.7 KiB

(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["plugin-webrtc"]=e():t["plugin-webrtc"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"11a1":function(t,e,n){"use strict";var r=n("30b5"),o=n.n(r);o.a},"30b5":function(t,e,n){},8875:function(t,e,n){var r,o,i;(function(n,a){o=[],r=a,i="function"===typeof r?r.apply(e,o):r,void 0===i||(t.exports=i)})("undefined"!==typeof self&&self,(function(){function t(){if(document.currentScript)return document.currentScript;try{throw new Error}catch(p){var t,e,n,r=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,i=r.exec(p.stack)||o.exec(p.stack),a=i&&i[1]||!1,s=i&&i[2]||!1,c=document.location.href.replace(document.location.hash,""),l=document.getElementsByTagName("script");a===c&&(t=document.documentElement.outerHTML,e=new RegExp("(?:[^\\n]+?\\n){0,"+(s-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),n=t.replace(e,"$1").trim());for(var u=0;u<l.length;u++){if("interactive"===l[u].readyState)return l[u];if(l[u].src===a)return l[u];if(a===c&&l[u].innerHTML&&l[u].innerHTML.trim()===n)return l[u]}return null}}return t}))},fb15:function(t,e,n){"use strict";if(n.r(e),"undefined"!==typeof window){var r=window.document.currentScript,o=n("8875");r=o(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:o});var i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[1==t.$parent.titleTabActive?n("pre",[t._v(t._s(t.localSDP))]):2==t.$parent.titleTabActive?n("pre",[t._v(t._s(t.remoteSDP))]):n("div",[n("mu-text-field",{attrs:{label:"streamPath"},model:{value:t.streamPath,callback:function(e){t.streamPath=e},expression:"streamPath"}}),!t.localSDP||t.ask?n("span",{staticClass:"blink"},[t._v("Connecting")]):t._e(),[n("m-button",{on:{click:function(e){return t.startSession("publish")}}},[t._v("Publish")]),n("m-button",{on:{click:function(e){return t.startSession("play")}}},[t._v("Play")])],n("m-button",{on:{click:t.stopSession}},[t._v("Stop")]),n("br"),n("video",{ref:"video1",attrs:{width:"640",height:"480",autoplay:"",muted:""},domProps:{srcObject:t.stream,muted:!0}})],2)])},s=[];const c={iceServers:[]};let l=new RTCPeerConnection(c);var u=null,p="live/rtc",d={data(){return{localSDP:l&&l.localDescription&&l.localDescription.sdp,remoteSDP:l&&l.remoteDescription&&l.remoteDescription.sdp,streamPath:p,iceConnectionState:l&&l.iceConnectionState,stream:u,type:"",ask:!1}},methods:{async startSession(t){if(this.type=t,this.ask=!0,"play"==t){const t=await this.ajax({url:"/webrtc/preparePlay?streamPath="+this.streamPath,dataType:"json"});if(t.errmsg)return void this.$toast.error(t.errmsg);p=this.streamPath,this.remoteSDP=t.sdp,l.ontrack=t=>{console.log(t),"monibuca"==t.streams[0].id&&(this.stream=u=t.streams[0])},await l.setRemoteDescription(new RTCSessionDescription(t)),await l.setLocalDescription(await l.createAnswer()),this.localSDP=l.localDescription.sdp}else l.addStream(u),await l.setLocalDescription(await l.createOffer()),this.loc
4 years ago
//# sourceMappingURL=plugin-webrtc.umd.min.js.map