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.2 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")}({"034f":function(t,e,n){"use strict";var r=n("85ec"),o=n.n(r);o.a},"85ec":function(t,e,n){},8875:function(t,e,n){var r,o,s;(function(n,i){o=[],r=i,s="function"===typeof r?r.apply(e,o):r,void 0===s||(t.exports=s)})("undefined"!==typeof self&&self,(function(){function t(){if(document.currentScript)return document.currentScript;try{throw new Error}catch(l){var t,e,n,r=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,s=r.exec(l.stack)||o.exec(l.stack),i=s&&s[1]||!1,c=s&&s[2]||!1,u=document.location.href.replace(document.location.hash,""),a=document.getElementsByTagName("script");i===u&&(t=document.documentElement.outerHTML,e=new RegExp("(?:[^\\n]+?\\n){0,"+(c-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),n=t.replace(e,"$1").trim());for(var d=0;d<a.length;d++){if("interactive"===a[d].readyState)return a[d];if(a[d].src===i)return a[d];if(i===u&&a[d].innerHTML&&a[d].innerHTML.trim()===n)return a[d]}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 s=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);s&&(n.p=s[1])}var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"root"},[t._v(" Browser SDP "),n("br"),n("textarea",{attrs:{readonly:"true",rows:"10",cols:"100"}},[t._v(t._s(t.localSDP||"loading..."))]),n("br"),t._v("Golang SDP "),n("br"),n("textarea",{attrs:{rows:"10",cols:"100"}},[t._v(t._s(t.remoteSDP))]),n("br"),n("mu-text-field",{attrs:{label:"streamPath"},model:{value:t.streamPath,callback:function(e){t.streamPath=e},expression:"streamPath"}}),t.localSDP?n("m-button",{on:{click:t.startSession}},[t._v("Start")]):t._e(),n("br"),n("br"),t._v("Video "),n("br"),n("video",{attrs:{id:"video1",width:"160",height:"120",autoplay:"",muted:""},domProps:{muted:!0}}),n("br"),t._v("Logs "),n("br"),n("div",{attrs:{id:"logs"}})],1)},c=[];let u=new RTCPeerConnection({iceServers:[{urls:["stun:stun.ekiga.net","stun:stun.ideasip.com","stun:stun.schlund.de","stun:stun.stunprotocol.org:3478","stun:stun.voiparound.com","stun:stun.voipbuster.com","stun:stun.voipstunt.com","stun:stun.voxgratia.org","stun:stun.services.mozilla.com","stun:stun.xten.com","stun:stun.softjoys.com","stun:stunserver.org","stun:stun.schlund.de","stun:stun.rixtelecom.se","stun:stun.iptel.org","stun:stun.ideasip.com","stun:stun.fwdnet.net","stun:stun.ekiga.net","stun:stun01.sipphone.com"]}]});var a={data(){return{localSDP:"",remoteSDP:"",streamPath:"live/rtc"}},methods:{startSession(){this.ajax({type:"POST",processData:!1,data:JSON.stringify(u.localDescription),url:"/webrtc/answer?streamPath="+this.streamPath,dataType:"json"}).then(t=>{this.remoteSDP=t.sdp,u.setRemoteDescription(new RTCSessionDescription(t))})}},mounted(){var t=t=>{document.getElementById("logs").innerHTML+=t+"<br>"};navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(e=>{u.addStream(document.getElementById("video1").srcObject=e),u.createOffer().then(t=>u.setLocalDescription(t)).catch(t)}).catch(t),u.oniceconnectionstatechange=e=>t(u.iceConnectionState),u.onicecandidate=t=>{null===t.candidate&&(this.localSDP=u.localDescription.sdp)}}},d=a;n("034f");function l(t,e,n,r,o,s,i,c){var u,a="function"===typeof t?t.options:t;if(e&&(a.render=e,a.staticRenderFns=n,a._compiled=!0),r&&(a.functional=!0),s&&(a._scopeId="data-v-"+s),i?(u=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},a._ssrRegister=u):o&&(u=c?function(){o.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:o),u)if(a.functional){a._injectStyles=u;var d=a.render;a.render=function(t,e){return u.call(e),d(t,e)}}else{var l=a.beforeCreate;a.beforeCreate=l?[].concat(l,u):[u]}return{exports:t,options:a}}var f=l(d,i,c,!1,null,null,null),p=f.exports;e["default"]=p}})["default"]}));
//# sourceMappingURL=plugin-webrtc.umd.min.js.map