matrixbirds 5 years ago
parent
commit
231c28df83
8 changed files with 10187 additions and 1 deletions
  1. 0
    1
      .gitignore
  2. 20
    0
      lib/AgoraView.native.js
  3. 1
    0
      lib/AgoraView.native.js.map
  4. 190
    0
      lib/RtcEngine.native.js
  5. 1
    0
      lib/RtcEngine.native.js.map
  6. 7
    0
      lib/index.js
  7. 1
    0
      lib/index.js.map
  8. 9967
    0
      package-lock.json

+ 0
- 1
.gitignore View File

61
 .jest/
61
 .jest/
62
 xcuserdata
62
 xcuserdata
63
 *.pbxproj
63
 *.pbxproj
64
-lib
65
 *.xcworkspace
64
 *.xcworkspace
66
 *.zip
65
 *.zip
67
 .byebug_history
66
 .byebug_history

+ 20
- 0
lib/AgoraView.native.js View File

1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const react_1 = tslib_1.__importDefault(require("react"));
5
+const react_native_1 = require("react-native");
6
+const RCTAgoraView = react_native_1.requireNativeComponent("RCTAgoraView");
7
+class AgoraView extends react_1.default.Component {
8
+    render() {
9
+        return (react_1.default.createElement(RCTAgoraView, Object.assign({}, this.getHTMLProps())));
10
+    }
11
+    getHTMLProps() {
12
+        let htmlProps = {};
13
+        for (let key in this.props) {
14
+            htmlProps[key] = this.props[key];
15
+        }
16
+        return htmlProps;
17
+    }
18
+}
19
+exports.default = AgoraView;
20
+//# sourceMappingURL=AgoraView.native.js.map

+ 1
- 0
lib/AgoraView.native.js.map View File

1
+{"version":3,"file":"AgoraView.native.js","sourceRoot":"","sources":["../src/AgoraView.native.tsx"],"names":[],"mappings":";;;AAAA,0DAA0B;AAC1B,+CAEqB;AAMrB,MAAM,YAAY,GAAG,qCAAsB,CAAC,cAAc,CAAC,CAAC;AAE5D,MAAqB,SAAU,SAAQ,eAAK,CAAC,SAAyB;IAC3D,MAAM;QACT,OAAO,CACH,8BAAC,YAAY,oBAAM,IAAI,CAAC,YAAY,EAAE,EAAK,CAC9C,CAAA;IACL,CAAC;IAEO,YAAY;QAChB,IAAI,SAAS,GAAG,EAAoB,CAAC;QACrC,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;YACxB,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAdD,4BAcC"}

+ 190
- 0
lib/RtcEngine.native.js View File

1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const react_native_1 = require("react-native");
4
+const { Agora } = react_native_1.NativeModules;
5
+const AgoraEventEmitter = new react_native_1.NativeEventEmitter(Agora);
6
+class RtcEngine {
7
+    static init(options) {
8
+        this.removeEmitter();
9
+        Agora.init(options);
10
+        this.listeners = [];
11
+    }
12
+    static joinChannel(channelName, uid, token, info) {
13
+        return Agora.joinChannel({ channelName, uid, token, info });
14
+    }
15
+    static joinChannelWithToken(channelName, token, uid) {
16
+        Agora.joinChannelWithToken(token, channelName, uid);
17
+    }
18
+    static eventEmitter(eventScheduler) {
19
+        this.removeEmitter();
20
+        // const events = EventSchedulerKeys;
21
+        const events = [
22
+            "onWarning",
23
+            "onError",
24
+            "onJoinChannelSuccess",
25
+            "onRejoinChannelSuccess",
26
+            "onLeaveChannel",
27
+            "onClientRoleChanged",
28
+            "onUserJoined",
29
+            "onUserOffline",
30
+            "onConnectionStateChanged",
31
+            "onConnectionInterrupted",
32
+            "onConnectionLost",
33
+            "onConnectionBanned",
34
+            "onApiCallExecuted",
35
+            "onTokenPrivilegeWillExpire",
36
+            "onRequestToken",
37
+            "onMicrophoneEnabled",
38
+            "onAudioVolumeIndication",
39
+            "onActiveSpeaker",
40
+            "onFirstLocalAudioFrame",
41
+            "onFirstRemoteAudioFrame",
42
+            "onVideoStopped",
43
+            "onFirstLocalVideoFrame",
44
+            "onFirstRemoteVideoDecoded",
45
+            "onFirstRemoteVideoFrame",
46
+            "onUserMuteAudio",
47
+            "onUserMuteVideo",
48
+            "onUserEnableVideo",
49
+            "onUserEnableLocalVideo",
50
+            "onVideoSizeChanged",
51
+            "onRemoteVideoStateChanged",
52
+            "onLocalPublishFallbackToAudioOnly",
53
+            "onRemoteSubscribeFallbackToAudioOnly",
54
+            "onAudioRouteChanged",
55
+            "onCameraReady",
56
+            "onCameraFocusAreaChanged",
57
+            "onCameraExposureAreaChanged",
58
+            "onAudioQuality",
59
+            "onRtcStats",
60
+            "onLastmileQuality",
61
+            "onNetworkQuality",
62
+            "onLocalVideoStats",
63
+            "onRemoteVideoStats",
64
+            "onRemoteAudioStats",
65
+            "onLocalVideoStat",
66
+            "onRemoteVideoStat",
67
+            "onRemoteAudioTransportStats",
68
+            "onRemoteVideoTransportStats",
69
+            "onAudioMixingFinished",
70
+            "onAudioEffectFinished",
71
+            "onStreamPublished",
72
+            "onStreamUnpublished",
73
+            "onTranscodingUpdated",
74
+            "onStreamInjectedStatus",
75
+            "onStreamMessage",
76
+            "onStreamMessageError",
77
+            "onMediaEngineLoadSuccess",
78
+            "onMediaEngineStartCallSuccess",
79
+        ];
80
+        for (let event of events) {
81
+            const functor = eventScheduler[event];
82
+            if (functor) {
83
+                this.listeners.push(AgoraEventEmitter.addListener(event, msg => {
84
+                    functor(msg);
85
+                }));
86
+            }
87
+        }
88
+    }
89
+    static removeEmitter() {
90
+        if (this.listeners && this.listeners.length > 0) {
91
+            for (let listener of this.listeners) {
92
+                listener.remove();
93
+            }
94
+        }
95
+        this.listeners = [];
96
+    }
97
+    static enableLastmileTest() {
98
+        Agora.enableLastmileTest();
99
+    }
100
+    static disableLastmileTest() {
101
+        Agora.disableLastmileTest();
102
+    }
103
+    static leaveChannel() {
104
+        return Agora.leaveChannel();
105
+    }
106
+    static destroy() {
107
+        Agora.destroy();
108
+    }
109
+    static setupLocalVideo(options) {
110
+        Agora.setupLocalVideo(options);
111
+    }
112
+    static setupRemoteVideo(options) {
113
+        Agora.setupRemoteVideo(options);
114
+    }
115
+    static startPreview() {
116
+        Agora.startPreview();
117
+    }
118
+    static stopPreview() {
119
+        Agora.stopPreview();
120
+    }
121
+    static configPublisher(options) {
122
+        Agora.configPublisher(options);
123
+    }
124
+    static setLiveTranscoding(options) {
125
+        Agora.setLiveTranscoding(options);
126
+    }
127
+    static setLocalRenderMode(mode) {
128
+        Agora.setLocalRenderMode(mode);
129
+    }
130
+    static setRemoteRenderMode(mode) {
131
+        Agora.setRemoteRenderMode(mode);
132
+    }
133
+    static enableAudioVolumeIndication(interval, smooth) {
134
+        Agora.enableAudioVolumeIndication(interval, smooth);
135
+    }
136
+    static switchCamera() {
137
+        Agora.switchCamera();
138
+    }
139
+    static enableVideo() {
140
+        Agora.enableVideo();
141
+    }
142
+    static disableVideo() {
143
+        Agora.disableVideo();
144
+    }
145
+    static setEnableSpeakerphone(status) {
146
+        Agora.setEnableSpeakerphone(status);
147
+    }
148
+    static muteLocalAudioStream(status) {
149
+        Agora.muteLocalAudioStream(status);
150
+    }
151
+    static muteRemoteAudioStream(uid, status) {
152
+        Agora.muteRemoteAudioStream(uid, status);
153
+    }
154
+    static muteAllRemoteAudioStreams(status) {
155
+        Agora.muteAllRemoteAudioStreams(status);
156
+    }
157
+    static setCameraTorchOn(status) {
158
+        return Agora.setCameraTorchOn(status);
159
+    }
160
+    static setCameraAutoFocusFaceModeEnabled(status) {
161
+        Agora.setCameraAutoFocusFaceModeEnabled(status);
162
+    }
163
+    static setDefaultAudioRouteToSpeakerphone(status) {
164
+        Agora.setDefaultAudioRouteToSpeakerphone(status);
165
+    }
166
+    static muteLocalVideoStream(status) {
167
+        Agora.muteLocalVideoStream(status);
168
+    }
169
+    static enableLocalVideo(status) {
170
+        Agora.enableLocalVideo(status);
171
+    }
172
+    static muteAllRemoteVideoStreams(status) {
173
+        Agora.muteAllRemoteVideoStreams(status);
174
+    }
175
+    static muteRemoteVideoStream(uid, status) {
176
+        Agora.muteRemoteVideoStream(uid, status);
177
+    }
178
+    static createDataStream(reliable, ordered, callback) {
179
+        Agora.createDataStream(reliable, ordered, callback);
180
+    }
181
+    static sendStreamMessage(streamId, data, callback) {
182
+        Agora.sendStreamMessage(streamId, data, callback);
183
+    }
184
+    static getSdkVersion(callback) {
185
+        Agora.getSdkVersion().then(callback);
186
+    }
187
+}
188
+exports.default = RtcEngine;
189
+;
190
+//# sourceMappingURL=RtcEngine.native.js.map

+ 1
- 0
lib/RtcEngine.native.js.map View File

1
+{"version":3,"file":"RtcEngine.native.js","sourceRoot":"","sources":["../src/RtcEngine.native.ts"],"names":[],"mappings":";;AAAA,+CAIsB;AAWtB,MAAM,EAAE,KAAK,EAAE,GAAG,4BAAa,CAAC;AAChC,MAAM,iBAAiB,GAAG,IAAI,iCAAkB,CAAC,KAAK,CAAC,CAAC;AAExD,MAAqB,SAAS;IAG1B,MAAM,CAAC,IAAI,CAAC,OAAe;QACvB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,WAAmB,EAAE,GAAY,EAAE,KAAc,EAAE,IAAa;QAC/E,OAAO,KAAK,CAAC,WAAW,CAAC,EAAC,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,CAAC,oBAAoB,CACvB,WAAmB,EAAE,KAAc,EAAE,GAAY;QACjD,KAAK,CAAC,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,cAA8B;QAC9C,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,qCAAqC;QACrC,MAAM,MAAM,GAAG;YACX,WAAW;YAEX,SAAS;YAET,sBAAsB;YAEtB,wBAAwB;YAExB,gBAAgB;YAEhB,qBAAqB;YAErB,cAAc;YAEd,eAAe;YAEf,0BAA0B;YAE1B,yBAAyB;YAEzB,kBAAk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C;IAED,MAAM,CAAC,qBAAqB,CAAC,GAAW,EAAE,MAAe;QACrD,KAAK,CAAC,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,QAAiB,EAAE,OAAgB,EAAE,QAAwB;QACjF,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,QAAgB,EAAE,IAAS,EAAE,QAAwB;QAC1E,KAAK,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,QAAwB;QACzC,KAAK,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACJ;AApRD,4BAoRC;AAAA,CAAC"}

+ 7
- 0
lib/index.js View File

1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+var AgoraView_native_1 = require("./AgoraView.native");
4
+exports.AgoraView = AgoraView_native_1.default;
5
+var RtcEngine_native_1 = require("./RtcEngine.native");
6
+exports.RtcEngine = RtcEngine_native_1.default;
7
+//# sourceMappingURL=index.js.map

+ 1
- 0
lib/index.js.map View File

1
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,uDAAwD;AAAhD,uCAAA,OAAO,CAAa;AAC5B,uDAAwD;AAAhD,uCAAA,OAAO,CAAa"}

+ 9967
- 0
package-lock.json
File diff suppressed because it is too large
View File