@realsee/live 0.4.0-alpha.4 → 0.4.0-beta.2
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/README.md +22 -0
- package/dist/realsee-live.cjs.development.js +10 -8
- 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 +10 -8
- package/dist/realsee-live.esm.js.map +1 -1
- package/dist/realsee-live.umd.development.js +10 -8
- 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/typings/react/LiveReact.d.ts +2 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/custom.css +43 -0
- package/docs/assets/highlight.css +120 -0
- package/docs/assets/icons.css +1043 -0
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +52 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1414 -0
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/BrowserRTC.html +68 -0
- package/docs/classes/BrowserRTC4Chime.html +76 -0
- package/docs/classes/CoreRTC.html +70 -0
- package/docs/classes/VRWebViewRTC.html +68 -0
- package/docs/enums/BuiltInRTCType.html +1 -0
- package/docs/enums/BuiltinActionType.html +15 -0
- package/docs/enums/BuiltinEventType.html +7 -0
- package/docs/enums/Command.html +7 -0
- package/docs/enums/MemUserStatus.html +1 -0
- package/docs/enums/MicroStatus.html +3 -0
- package/docs/enums/RTCJoinedInfoCodeEnum.html +11 -0
- package/docs/enums/RTCType.html +3 -0
- package/docs/enums/UserStatus.html +9 -0
- package/docs/enums/WebSocketCloseError.html +19 -0
- package/docs/enums/WebSocketErrorType.html +1 -0
- package/docs/enums/WebSocketState.html +13 -0
- package/docs/index.html +386 -0
- package/docs/interfaces/AttendeeResponse.html +1 -0
- package/docs/interfaces/GetVoiceSignReturnType.html +3 -0
- package/docs/interfaces/Live.html +116 -0
- package/docs/interfaces/LiveOptions.html +39 -0
- package/docs/interfaces/LiveReact.html +52 -0
- package/docs/interfaces/MeetingResponse.html +1 -0
- package/docs/interfaces/MeetingSessionConfigurationOptions.html +1 -0
- package/docs/interfaces/RTCJoinedInfo.html +3 -0
- package/docs/interfaces/RTCProtocol.html +70 -0
- package/docs/interfaces/VRWebViewRTCOptions.html +1 -0
- package/docs/modules.html +133 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -338,6 +338,28 @@ const live = createLive({
|
|
|
338
338
|
});
|
|
339
339
|
```
|
|
340
340
|
|
|
341
|
+
### 使用内置的 JsBridge 和 RTC 实现
|
|
342
|
+
|
|
343
|
+
使用方式:
|
|
344
|
+
|
|
345
|
+
```tsx
|
|
346
|
+
import { createLive } from '@realsee/live';
|
|
347
|
+
|
|
348
|
+
const live = createLive({
|
|
349
|
+
useBuiltInRTC: true, // 使用内置rtc
|
|
350
|
+
builtInRTCType: BuiltInRTCType.RealseeXChimeRTC, // 内置 rtc 类型,不填则默认trtc,chime请指明
|
|
351
|
+
useBuiltInJsBridge: true, // 使用内置的jsBridge
|
|
352
|
+
getVoiceSign, // 内置的rtc还是要把 getVoiceSign 方法传递进去
|
|
353
|
+
getTicket: async () => '' /* 必须提供 */,
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
// 可以直接使用里面的 jsBridge, 该实例由 @realsee/jsbridge-x 提供支持
|
|
357
|
+
const jsBridge = live.jsBridge;
|
|
358
|
+
jsBridge
|
|
359
|
+
.ready()
|
|
360
|
+
.then(() => console.info(`${jsBridge.webViewType} jsBridge is ready`));
|
|
361
|
+
```
|
|
362
|
+
|
|
341
363
|
## TypeScript & React 支持
|
|
342
364
|
|
|
343
365
|
**Live** 有完整的 [TypeScript Generics](https://www.typescriptlang.org/docs/handbook/2/generics.html)
|
|
@@ -1268,6 +1268,10 @@ function createLive(options) {
|
|
|
1268
1268
|
var _a, _b, _c;
|
|
1269
1269
|
super();
|
|
1270
1270
|
this.keyframes = new Subscribe();
|
|
1271
|
+
const jsBridge = ((_a = options.jsBridge) !== null && _a !== void 0 ? _a : options.useBuiltInJsBridge)
|
|
1272
|
+
? new JSBridge__default["default"]()
|
|
1273
|
+
: undefined;
|
|
1274
|
+
liveController.options.jsBridge = jsBridge;
|
|
1271
1275
|
// 没有传rtc实例时
|
|
1272
1276
|
if (!options.rtc) {
|
|
1273
1277
|
// 取指定的内部rtc类型
|
|
@@ -1275,15 +1279,15 @@ function createLive(options) {
|
|
|
1275
1279
|
if (!options.getVoiceSign) {
|
|
1276
1280
|
throw new Error('GetVoiceSign method must be passed when using built-in RTC instances');
|
|
1277
1281
|
}
|
|
1278
|
-
const getVoiceSign = (
|
|
1282
|
+
const getVoiceSign = (_b = options.getVoiceSign) !== null && _b !== void 0 ? _b : unimplementedGetVoiceSign;
|
|
1279
1283
|
switch (options.rtcType) {
|
|
1280
1284
|
case exports.RTCType.RealseeVRWebViewRTC: {
|
|
1281
1285
|
// 内置的 VRWebViewRTC
|
|
1282
|
-
if (!
|
|
1286
|
+
if (!jsBridge) {
|
|
1283
1287
|
throw new Error('JsBridge instance must be passed when using built-in VRWebViewRTC instances');
|
|
1284
1288
|
}
|
|
1285
1289
|
liveController.options.rtc = new VRWebViewRTC({
|
|
1286
|
-
jsBridge
|
|
1290
|
+
jsBridge,
|
|
1287
1291
|
getVoiceSign,
|
|
1288
1292
|
});
|
|
1289
1293
|
break;
|
|
@@ -1313,14 +1317,10 @@ function createLive(options) {
|
|
|
1313
1317
|
if (!options.getVoiceSign) {
|
|
1314
1318
|
throw new Error('GetVoiceSign method must be passed when using built-in RTC instances');
|
|
1315
1319
|
}
|
|
1316
|
-
const getVoiceSign = (
|
|
1317
|
-
const jsBridge = ((_c = options.jsBridge) !== null && _c !== void 0 ? _c : options.useBuiltInJsBridge)
|
|
1318
|
-
? new JSBridge__default["default"]()
|
|
1319
|
-
: null;
|
|
1320
|
+
const getVoiceSign = (_c = options.getVoiceSign) !== null && _c !== void 0 ? _c : unimplementedGetVoiceSign;
|
|
1320
1321
|
if (!jsBridge) {
|
|
1321
1322
|
throw new Error('jsBridge instance must be passed when using built-in RTC instances');
|
|
1322
1323
|
}
|
|
1323
|
-
options.jsBridge = jsBridge;
|
|
1324
1324
|
// vrwebview 默认
|
|
1325
1325
|
if ((isRealseeVRWebview && (isAndroid || isIOS)) || isWxMiniProgram) {
|
|
1326
1326
|
liveController.options.rtc = new VRWebViewRTC({
|
|
@@ -1632,6 +1632,7 @@ function createLive(options) {
|
|
|
1632
1632
|
function createLiveReact(options) {
|
|
1633
1633
|
const LiveContext = React__default["default"].createContext(null);
|
|
1634
1634
|
const live = createLive(options);
|
|
1635
|
+
const jsBridge = live.jsBridge;
|
|
1635
1636
|
function LiveProvider(props) {
|
|
1636
1637
|
return (React__default["default"].createElement(LiveContext.Provider, { value: props.live || live }, props.children));
|
|
1637
1638
|
}
|
|
@@ -1827,6 +1828,7 @@ function createLiveReact(options) {
|
|
|
1827
1828
|
}
|
|
1828
1829
|
return {
|
|
1829
1830
|
live,
|
|
1831
|
+
jsBridge,
|
|
1830
1832
|
LiveProvider,
|
|
1831
1833
|
unsafe__useLiveInstance,
|
|
1832
1834
|
unsafe__useRTCInstance,
|