1
0
Fork 0
Agora-Miniapp-Tutorial/lib/mini-app-sdk-production.js

15 lines
156 KiB
JavaScript
Raw Normal View History

2022-06-20 11:25:53 +08:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("AgoraSDK",[],t):"object"==typeof exports?exports.AgoraSDK=t():e.AgoraSDK=t()}(window,(function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=54)}([function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(i(36)),a=i(5),o=r(i(1)),u=i(6),l=i(4),h=()=>{};class c extends s.default{constructor(e,t){super(),this._state=g.RELAY_STATE_IDLE,this._onStatus=e=>{o.default.debug(`[${this.clientId}] ChannelMediaStatus: ${JSON.stringify(e)}`),e&&e.command&&("onAudioPacketReceived"===e.command&&this.emit("event",v.PACKET_RECEIVED_AUDIO_FROM_SRC),"onVideoPacketReceived"===e.command&&this.emit("event",v.PACKET_RECEIVED_VIDEO_FROM_SRC),"onSrcTokenPrivilegeDidExpire"===e.command&&(this._state=g.RELAY_STATE_FAILURE,this.emit("state",g.RELAY_STATE_FAILURE,T.SRC_TOKEN_EXPIRED)),"onDestTokenPrivilegeDidExpire"===e.command&&(this._state=g.RELAY_STATE_FAILURE,this.emit("state",g.RELAY_STATE_FAILURE,T.DEST_TOKEN_EXPIRED,e.channelName?{came:e.channelName}:null)))},this._onClose=()=>n(this,void 0,void 0,(function*(){if(o.default.debug(`[${this.clientId}] ChannelMediaSocket onClose`),this.emit("event",v.NETWORK_DISCONNECTED),this.state=g.RELAY_STATE_IDLE,this._prevChannelMediaConfig)try{yield this.startChannelMediaRelay(this._prevChannelMediaConfig)}catch(e){if(e instanceof p&&(e.message===f.WS_ABORT||e.message===f.AP_REQUEST_ABORT))return;this.emit("state",g.RELAY_STATE_FAILURE,T.SERVER_CONNECTION_LOST)}})),this.token=e.appId,this.appId=e.appId,this.cname=e.cname,this.uid=e.uid,this.sid=e.sid,this.clientId=t}set state(e){const t=this._state;this._state=e,t!==e&&this.emit("state",e)}get state(){return this._state}startChannelMediaRelay(e){return n(this,void 0,void 0,(function*(){if(this.state!==g.RELAY_STATE_IDLE)throw new p(f.BAD_STATE);this.state=g.RELAY_STATE_CONNECTING,yield this._connect(),o.default.debug(`[${this.clientId}] startChannelMediaRelay: connect success`),yield this._sendStartRelayMessage(e),this._prevChannelMediaConfig=e}))}updateChannelMediaRelay(e){return n(this,void 0,void 0,(function*(){if(this.state!==g.RELAY_STATE_RUNNING)throw new p(f.BAD_STATE);yield this._sendUpdateMessage(e),this._prevChannelMediaConfig=e}))}stopChannelMediaRelay(){return n(this,void 0,void 0,(function*(){yield this._sendStopRelayMessage(),o.default.debug(`[${this.clientId}] stopChannelMediaRelay: send stop message success`),this.state=g.RELAY_STATE_IDLE,this.dispose()}))}dispose(){o.default.debug(`[${this.clientId}] disposeChannelMediaRelay`),this.state=g.RELAY_STATE_IDLE,this.emit("dispose"),this._signal&&this._signal.dispose(),this._prevChannelMediaConfig=null,this.removeEvent()}_requestOneAP(e){return new Promise((t,i)=>{const n={command:"conve
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
e.exports=function(e){return null!=e&&(i(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&i(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,i){var n;
/*!
* EventEmitter v5.2.9 - git.io/ee
* Unlicense - http://unlicense.org/
* Oliver Caldwell - https://oli.me.uk/
* @preserve
*/!function(t){"use strict";function r(){}var s=r.prototype,a=t.EventEmitter;function o(e,t){for(var i=e.length;i--;)if(e[i].listener===t)return i;return-1}function u(e){return function(){return this[e].apply(this,arguments)}}s.getListeners=function(e){var t,i,n=this._getEvents();if(e instanceof RegExp)for(i in t={},n)n.hasOwnProperty(i)&&e.test(i)&&(t[i]=n[i]);else t=n[e]||(n[e]=[]);return t},s.flattenListeners=function(e){var t,i=[];for(t=0;t<e.length;t+=1)i.push(e[t].listener);return i},s.getListenersAsObject=function(e){var t,i=this.getListeners(e);return i instanceof Array&&((t={})[e]=i),t||i},s.addListener=function(e,t){if(!function e(t){return"function"==typeof t||t instanceof RegExp||!(!t||"object"!=typeof t)&&e(t.listener)}(t))throw new TypeError("listener must be a function");var i,n=this.getListenersAsObject(e),r="object"==typeof t;for(i in n)n.hasOwnProperty(i)&&-1===o(n[i],t)&&n[i].push(r?t:{listener:t,once:!1});return this},s.on=u("addListener"),s.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},s.once=u("addOnceListener"),s.defineEvent=function(e){return this.getListeners(e),this},s.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},s.removeListener=function(e,t){var i,n,r=this.getListenersAsObject(e);for(n in r)r.hasOwnProperty(n)&&-1!==(i=o(r[n],t))&&r[n].splice(i,1);return this},s.off=u("removeListener"),s.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},s.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},s.manipulateListeners=function(e,t,i){var n,r,s=e?this.removeListener:this.addListener,a=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(n=i.length;n--;)s.call(this,t,i[n]);else for(n in t)t.hasOwnProperty(n)&&(r=t[n])&&("function"==typeof r?s.call(this,n,r):a.call(this,n,r));return this},s.removeEvent=function(e){var t,i=typeof e,n=this._getEvents();if("string"===i)delete n[e];else if(e instanceof RegExp)for(t in n)n.hasOwnProperty(t)&&e.test(t)&&delete n[t];else delete this._events;return this},s.removeAllListeners=u("removeEvent"),s.emitEvent=function(e,t){var i,n,r,s,a=this.getListenersAsObject(e);for(s in a)if(a.hasOwnProperty(s))for(i=a[s].slice(0),r=0;r<i.length;r++)!0===(n=i[r]).once&&this.removeListener(e,n.listener),n.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},s.trigger=u("emitEvent"),s.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},s.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},s._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},s._getEvents=function(){return this._events||(this._events={})},r.noConflict=function(){return t.EventEmitter=a,r},void 0===(n=function(){return r}.call(t,i,t,e))||(e.exports=n)}("undefined"!=typeof window?window:this||{})},function(e,t,i){var n=i(9).default,r=i(16),s=function(e){this.item=null,e&&void 0!==e.item&&null!==e.item&&(this.item=new r(e.item))};(s.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.item=new r,this.item.read(e)):e.skip(i);break;case 0:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},s.prototype.write=function(e){e.writeStructBegin("ReportService_Report_args"),null!==this.item&&void 0!==this.item&&(e.writeFieldBegin("item",n.Type.STRUCT,1),this.item.write(e),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var a=function(e){};(a.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype);t.fid;if(i==n.Type.STOP)break;e.skip(i),e.readFieldEnd()}e.readStructEnd()},a.prototype.write=function(e){e.writeStructBegin("ReportService_Report_result"),e.writeFieldStop(),e.writeStructEnd()};var o=function(e,t){this.input=e,this.output=t||e,this.seqid=0};(o.prototype={}).Report=function(e,t){this.send_Report(e,t),t||this.recv_Report()},o.
//# sourceMappingURL=mini-app-sdk-production.js.map