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
4.5 KiB

5 years ago
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["plugin-webrtc"]=t():e["plugin-webrtc"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({8875:function(e,t,n){var r,o,i;(function(n,c){o=[],r=c,i="function"===typeof r?r.apply(t,o):r,void 0===i||(e.exports=i)})("undefined"!==typeof self&&self,(function(){function e(){if(document.currentScript)return document.currentScript;try{throw new Error}catch(l){var e,t,n,r=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,i=r.exec(l.stack)||o.exec(l.stack),c=i&&i[1]||!1,s=i&&i[2]||!1,a=document.location.href.replace(document.location.hash,""),u=document.getElementsByTagName("script");c===a&&(e=document.documentElement.outerHTML,t=new RegExp("(?:[^\\n]+?\\n){0,"+(s-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),n=e.replace(t,"$1").trim());for(var d=0;d<u.length;d++){if("interactive"===u[d].readyState)return u[d];if(u[d].src===c)return u[d];if(c===a&&u[d].innerHTML&&u[d].innerHTML.trim()===n)return u[d]}return null}}return e}))},fb15:function(e,t,n){"use strict";if(n.r(t),"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 c=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[e._v(" Browser base64 Session Description "),n("br"),n("textarea",{attrs:{readonly:"true"},domProps:{value:e.localDescription}}),n("br"),e._v("Golang base64 Session Description "),n("br"),n("textarea",{domProps:{value:e.remoteSessionDescription}}),n("br"),n("button",{on:{click:e.startSession}},[e._v("Start Session")]),n("br"),n("br"),e._v("Video "),n("br"),n("video",{attrs:{id:"video1",width:"160",height:"120",autoplay:"",muted:""},domProps:{muted:!0}}),n("br"),e._v("Logs "),n("br"),n("div",{attrs:{id:"logs"}})])},s=[];let a=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});var u={data(){return{localDescription:"",remoteSessionDescription:""}},methods:{startSession(){this.ajax.post("/webrtc/answer",this.localDescription).then(e=>{this.remoteSessionDescription=e,a.setRemoteDescription(new RTCSessionDescription(e))})}},mounted(){var e=e=>{document.getElementById("logs").innerHTML+=e+"<br>"};navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(t=>{a.addStream(document.getElementById("video1").srcObject=t),a.createOffer().then(e=>a.setLocalDescription(e)).catch(e)}).catch(e),a.oniceconnectionstatechange=t=>e(a.iceConnectionState),a.onicecandidate=e=>{null===e.candidate&&(this.localDescription=JSON.stringify(a.localDescription))}}},d=u;function l(e,t,n,r,o,i,c,s){var a,u="function"===typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),c?(a=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._re
//# sourceMappingURL=plugin-webrtc.umd.min.js.map