@realsee/live 0.5.0-alpha.8 → 0.5.2-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/live/createLive.d.ts +1 -1
- package/dist/live/createLiveReact.d.ts +4 -4
- package/dist/live/live.d.ts +1 -1
- package/dist/realsee-live.cjs.development.js +33 -24
- package/dist/realsee-live.cjs.development.js.map +1 -1
- package/dist/realsee-live.cjs.production.js +1 -1
- package/dist/realsee-live.cjs.production.js.map +1 -1
- package/dist/realsee-live.esm.js +34 -25
- package/dist/realsee-live.esm.js.map +1 -1
- package/dist/realsee-live.umd.development.js +849 -1015
- package/dist/realsee-live.umd.development.js.map +1 -1
- package/dist/realsee-live.umd.production.js +1 -1
- package/dist/realsee-live.umd.production.js.map +1 -1
- package/dist/rtc/BrowserRTC.d.ts +1 -0
- package/dist/typings/rtc/protocol.d.ts +5 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/BrowserRTC.html +10 -10
- package/docs/interfaces/RTCProtocol.html +12 -10
- package/docs/modules.html +10 -4
- package/package.json +6 -5
package/dist/realsee-live.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import JSBridge from '@realsee/jsbridge-x';
|
|
2
2
|
import TRTC from 'trtc-js-sdk';
|
|
3
3
|
import { DefaultModality, ConsoleLogger, LogLevel as LogLevel$1, DefaultDeviceController, MeetingSessionConfiguration, DefaultMeetingSession, MeetingSessionStatusCode } from 'amazon-chime-sdk-js';
|
|
4
|
-
import React, { createContext
|
|
4
|
+
import React, { createContext } from 'react';
|
|
5
5
|
|
|
6
6
|
const EVENT_SYMBOL = Symbol('$$REALSEE_LIVE_EVENT$$');
|
|
7
7
|
function __generateEventIfNotExisted(instance) {
|
|
@@ -194,6 +194,7 @@ class BrowserRTC extends CoreRTC {
|
|
|
194
194
|
this._getVoiceSign = () => {
|
|
195
195
|
throw new Error('方法 getVoiceSign 未实现');
|
|
196
196
|
};
|
|
197
|
+
this.checkRequirement = () => TRTC.checkSystemRequirements();
|
|
197
198
|
this.$dom = document.createElement('div');
|
|
198
199
|
this._trtc = {
|
|
199
200
|
client: null,
|
|
@@ -308,9 +309,10 @@ class BrowserRTC extends CoreRTC {
|
|
|
308
309
|
var _a, _b, _c, _d;
|
|
309
310
|
(_a = this._trtc.client) === null || _a === void 0 ? void 0 : _a.on('stream-added', this._handleStreamAdded);
|
|
310
311
|
(_b = this._trtc.client) === null || _b === void 0 ? void 0 : _b.on('stream-subscribed', this._handleStreamSubscribed);
|
|
311
|
-
(_c = this._trtc.client) === null || _c === void 0 ? void 0 : _c.on('audio-volume', (event) => this.emit('userVolumes',
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
(_c = this._trtc.client) === null || _c === void 0 ? void 0 : _c.on('audio-volume', (event) => this.emit('userVolumes', event.result.map(({ userId, audioVolume }) => ({
|
|
313
|
+
userId,
|
|
314
|
+
audioVolume,
|
|
315
|
+
}))));
|
|
314
316
|
(_d = this._trtc.client) === null || _d === void 0 ? void 0 : _d.on('error', (event) => this.emit('error', event));
|
|
315
317
|
}
|
|
316
318
|
}
|
|
@@ -1705,7 +1707,7 @@ class Live extends Subscribe {
|
|
|
1705
1707
|
this._handleMessage = (liveMsg) => __awaiter(this, void 0, void 0, function* () {
|
|
1706
1708
|
var _b, _c, _d, _e, _f, _g;
|
|
1707
1709
|
if (typeof liveMsg === 'object') {
|
|
1708
|
-
const { command, data, frontRequestId, code, message } = liveMsg;
|
|
1710
|
+
const { command, data = {}, frontRequestId, code, message } = liveMsg;
|
|
1709
1711
|
if (code === 'SUCCESS') {
|
|
1710
1712
|
switch (command) {
|
|
1711
1713
|
/**
|
|
@@ -1874,6 +1876,13 @@ class Live extends Subscribe {
|
|
|
1874
1876
|
return false;
|
|
1875
1877
|
}
|
|
1876
1878
|
const { force = false } = options;
|
|
1879
|
+
// 检测一下麦克风权限,hack
|
|
1880
|
+
if (this._options.rtc) {
|
|
1881
|
+
const res = yield this._options.rtc.detectMicro();
|
|
1882
|
+
if (!res) {
|
|
1883
|
+
return new Error('Failed to obtain microphone authorization');
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1877
1886
|
// 检查是否已有实例在使用
|
|
1878
1887
|
const currentState = this.state;
|
|
1879
1888
|
if (currentState === LiveState.CONNECTING ||
|
|
@@ -2248,21 +2257,21 @@ function createLiveReact(options) {
|
|
|
2248
2257
|
* @deprecated
|
|
2249
2258
|
* @returns
|
|
2250
2259
|
*/
|
|
2251
|
-
const unsafe__useLiveInstance =
|
|
2260
|
+
const unsafe__useLiveInstance = () => live;
|
|
2252
2261
|
/**
|
|
2253
2262
|
* 使用rtc实例
|
|
2254
2263
|
*/
|
|
2255
|
-
const useRTCInstance =
|
|
2264
|
+
const useRTCInstance = () => live.$RTC;
|
|
2256
2265
|
/**
|
|
2257
2266
|
* 不建议这样使用
|
|
2258
2267
|
* @deprecated
|
|
2259
2268
|
* @returns
|
|
2260
2269
|
*/
|
|
2261
|
-
const unsafe__useRTCInstance =
|
|
2270
|
+
const unsafe__useRTCInstance = () => useRTCInstance();
|
|
2262
2271
|
/**
|
|
2263
2272
|
* 带看连接操作
|
|
2264
2273
|
*/
|
|
2265
|
-
const useConnect =
|
|
2274
|
+
const useConnect = () => (options) => __awaiter(this, void 0, void 0, function* () { return yield live.connect(options); });
|
|
2266
2275
|
/**
|
|
2267
2276
|
*
|
|
2268
2277
|
* @param name
|
|
@@ -2286,17 +2295,17 @@ function createLiveReact(options) {
|
|
|
2286
2295
|
*/
|
|
2287
2296
|
function useLiveAction() {
|
|
2288
2297
|
const live = useLiveInstance();
|
|
2289
|
-
const connect =
|
|
2290
|
-
const toggleMicro =
|
|
2291
|
-
const broadcast =
|
|
2292
|
-
const exit =
|
|
2293
|
-
const kick =
|
|
2294
|
-
const forbidMicro =
|
|
2295
|
-
const forbidSync =
|
|
2296
|
-
const getFramesByKey =
|
|
2297
|
-
const sendKeyframe =
|
|
2298
|
-
const setSelfInfo =
|
|
2299
|
-
const updateStatus =
|
|
2298
|
+
const connect = (options) => __awaiter(this, void 0, void 0, function* () { return yield live.connect(options); });
|
|
2299
|
+
const toggleMicro = (microStatus) => live.toggleMicro(microStatus);
|
|
2300
|
+
const broadcast = (data, toUserIds, timeout = 0) => __awaiter(this, void 0, void 0, function* () { return yield live.broadcast(data, toUserIds, timeout); });
|
|
2301
|
+
const exit = () => __awaiter(this, void 0, void 0, function* () { return yield live.exit(); });
|
|
2302
|
+
const kick = (toUserIds) => __awaiter(this, void 0, void 0, function* () { return yield live.kick(toUserIds); });
|
|
2303
|
+
const forbidMicro = (micro, toUserIds = []) => __awaiter(this, void 0, void 0, function* () { return yield live.forbidMicro(micro, toUserIds); });
|
|
2304
|
+
const forbidSync = (sync, toUserIds = []) => live.forbidSync(sync, toUserIds);
|
|
2305
|
+
const getFramesByKey = (key) => live.getFramesByKey(key);
|
|
2306
|
+
const sendKeyframe = (key, frame) => live.sendKeyframe(key, frame);
|
|
2307
|
+
const setSelfInfo = (userInfo) => live.setSelfInfo(userInfo);
|
|
2308
|
+
const updateStatus = (evtType, atnType, status, toUserIds) => live.updateStatus(evtType, atnType, status, toUserIds);
|
|
2300
2309
|
return {
|
|
2301
2310
|
connect,
|
|
2302
2311
|
broadcast,
|
|
@@ -2350,11 +2359,11 @@ function createLiveReact(options) {
|
|
|
2350
2359
|
}
|
|
2351
2360
|
function useRTCAction() {
|
|
2352
2361
|
const live = useLiveInstance();
|
|
2353
|
-
const join =
|
|
2354
|
-
const quit =
|
|
2355
|
-
const shock =
|
|
2356
|
-
const toggleMicro =
|
|
2357
|
-
const detectMicro =
|
|
2362
|
+
const join = (options) => live.$RTC.join(options);
|
|
2363
|
+
const quit = () => live.$RTC.quit();
|
|
2364
|
+
const shock = () => { var _a, _b; return (_b = (_a = live.$RTC).shock) === null || _b === void 0 ? void 0 : _b.call(_a); };
|
|
2365
|
+
const toggleMicro = (flag) => live.$RTC.toggleMicro(flag);
|
|
2366
|
+
const detectMicro = () => live.$RTC.detectMicro();
|
|
2358
2367
|
return {
|
|
2359
2368
|
join,
|
|
2360
2369
|
quit,
|