@realsee/live 0.5.0-alpha.9 → 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 +28 -26
- 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 +29 -27
- package/dist/realsee-live.esm.js.map +1 -1
- package/dist/realsee-live.umd.development.js +1194 -1286
- 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
|
/**
|
|
@@ -1875,8 +1877,8 @@ class Live extends Subscribe {
|
|
|
1875
1877
|
}
|
|
1876
1878
|
const { force = false } = options;
|
|
1877
1879
|
// 检测一下麦克风权限,hack
|
|
1878
|
-
if (this._options.rtc
|
|
1879
|
-
const res = yield this._options.
|
|
1880
|
+
if (this._options.rtc) {
|
|
1881
|
+
const res = yield this._options.rtc.detectMicro();
|
|
1880
1882
|
if (!res) {
|
|
1881
1883
|
return new Error('Failed to obtain microphone authorization');
|
|
1882
1884
|
}
|
|
@@ -2255,21 +2257,21 @@ function createLiveReact(options) {
|
|
|
2255
2257
|
* @deprecated
|
|
2256
2258
|
* @returns
|
|
2257
2259
|
*/
|
|
2258
|
-
const unsafe__useLiveInstance =
|
|
2260
|
+
const unsafe__useLiveInstance = () => live;
|
|
2259
2261
|
/**
|
|
2260
2262
|
* 使用rtc实例
|
|
2261
2263
|
*/
|
|
2262
|
-
const useRTCInstance =
|
|
2264
|
+
const useRTCInstance = () => live.$RTC;
|
|
2263
2265
|
/**
|
|
2264
2266
|
* 不建议这样使用
|
|
2265
2267
|
* @deprecated
|
|
2266
2268
|
* @returns
|
|
2267
2269
|
*/
|
|
2268
|
-
const unsafe__useRTCInstance =
|
|
2270
|
+
const unsafe__useRTCInstance = () => useRTCInstance();
|
|
2269
2271
|
/**
|
|
2270
2272
|
* 带看连接操作
|
|
2271
2273
|
*/
|
|
2272
|
-
const useConnect =
|
|
2274
|
+
const useConnect = () => (options) => __awaiter(this, void 0, void 0, function* () { return yield live.connect(options); });
|
|
2273
2275
|
/**
|
|
2274
2276
|
*
|
|
2275
2277
|
* @param name
|
|
@@ -2293,17 +2295,17 @@ function createLiveReact(options) {
|
|
|
2293
2295
|
*/
|
|
2294
2296
|
function useLiveAction() {
|
|
2295
2297
|
const live = useLiveInstance();
|
|
2296
|
-
const connect =
|
|
2297
|
-
const toggleMicro =
|
|
2298
|
-
const broadcast =
|
|
2299
|
-
const exit =
|
|
2300
|
-
const kick =
|
|
2301
|
-
const forbidMicro =
|
|
2302
|
-
const forbidSync =
|
|
2303
|
-
const getFramesByKey =
|
|
2304
|
-
const sendKeyframe =
|
|
2305
|
-
const setSelfInfo =
|
|
2306
|
-
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);
|
|
2307
2309
|
return {
|
|
2308
2310
|
connect,
|
|
2309
2311
|
broadcast,
|
|
@@ -2357,11 +2359,11 @@ function createLiveReact(options) {
|
|
|
2357
2359
|
}
|
|
2358
2360
|
function useRTCAction() {
|
|
2359
2361
|
const live = useLiveInstance();
|
|
2360
|
-
const join =
|
|
2361
|
-
const quit =
|
|
2362
|
-
const shock =
|
|
2363
|
-
const toggleMicro =
|
|
2364
|
-
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();
|
|
2365
2367
|
return {
|
|
2366
2368
|
join,
|
|
2367
2369
|
quit,
|