@bddh/starling-realtime-client 1.0.0-beta.5 → 1.0.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/cjs/BrtcClient.d.ts +0 -2
- package/cjs/BrtcClient.js +1 -1
- package/cjs/Client.d.ts +3 -1
- package/cjs/Client.js +1 -1
- package/cjs/DomControl.js +1 -1
- package/cjs/Server.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/interface.d.ts +14 -0
- package/cjs/interface.js +1 -1
- package/es/BrtcClient.d.ts +0 -2
- package/es/BrtcClient.js +1 -1
- package/es/Client.d.ts +3 -1
- package/es/Client.js +1 -1
- package/es/DomControl.js +1 -1
- package/es/Server.js +1 -1
- package/es/index.js +1 -1
- package/es/interface.d.ts +14 -0
- package/es/interface.js +1 -1
- package/package.json +2 -2
- /package/cjs/{dh-realtime-human/src/DomControl.d.ts → DomControl.d.ts} +0 -0
- /package/es/{dh-realtime-human/src/DomControl.d.ts → DomControl.d.ts} +0 -0
package/cjs/BrtcClient.d.ts
CHANGED
|
@@ -66,7 +66,6 @@ export interface RtcCallback {
|
|
|
66
66
|
onDigitalHumanCallback: (data: CallbackMsgType) => void;
|
|
67
67
|
}
|
|
68
68
|
interface BrtcClientType {
|
|
69
|
-
brtcParams: any;
|
|
70
69
|
videoWrapperId: string;
|
|
71
70
|
bizConfig: BizConfig;
|
|
72
71
|
closeLog?: boolean;
|
|
@@ -78,7 +77,6 @@ interface BrtcClientType {
|
|
|
78
77
|
declare class BrtcClient {
|
|
79
78
|
client?: BRtcInstance;
|
|
80
79
|
isRtcVideoOn: boolean;
|
|
81
|
-
private readonly brtcParams?;
|
|
82
80
|
private rtcConnection;
|
|
83
81
|
private readonly rtcConfig?;
|
|
84
82
|
private readonly bizConfig?;
|
package/cjs/BrtcClient.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@bddh/starling-brtc"),e=require("@bddh/starling-timeout-controller"),o=require("@bddh/starling-json"),i=require("lodash/isEmpty"),n=require("lodash/isFunction"),s=require("./interface.js");exports.default=class{client;isRtcVideoOn=!1;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@bddh/starling-brtc"),e=require("@bddh/starling-timeout-controller"),o=require("@bddh/starling-json"),i=require("lodash/isEmpty"),n=require("lodash/isFunction"),s=require("./interface.js");exports.default=class{client;isRtcVideoOn=!1;rtcConnection;rtcConfig;bizConfig;rtcCallback;restarting=!1;timeoutEvent;reopenTimer;restartCount=0;closeLog=!0;haveVideoOn=!1;rtcStateCallback=null;constructor(t){const{rtcConnection:o,rtcConfig:i,closeLog:n=!0,rtcCallback:s}=t;this.rtcConnection=o,this.rtcConfig=i,this.rtcCallback=s,this.closeLog=n,this.timeoutEvent=new e.TimeoutController(6e4,(()=>{if(!this.rtcConnection)return!this.closeLog&&console.warn("remotevideoon事件超时, rtcConnectionRef is null");this.timeoutEvent.clear(),this.restartRtc?.(this.rtcConnection)}))}openRtc=e=>{if(this.restarting)!this.closeLog&&console.warn("rtc restarting");else if(e&&(this.rtcConnection=e),this.rtcConnection&&!i(this.rtcConnection)){const{server:i,appId:c,token:r,roomName:a,userId:l}=this.rtcConnection,{onRemotedata:d,onLocalStream:h,onRemoteVideoComing:u,onLocalVideoPublished:m,onLocalVideoPublishing:C,onRemoteVideoOn:g,onRemoteVideoOff:b,onRemoteVideoLoading:L,onSuccess:R,onError:f,onLocalVideoConnected:y,onRemoteVideoConnected:v,onRemoteMediaState:E,onPlayingError:S,onDigitalHumanCallback:V}=this.rtcCallback||{};this.timeoutEvent.start(),this.rtcStateCallback=t=>{const{body:e,action:o}=t;V&&V({status:s.statusEnum.DH_LIB_FULL_STATUS,content:{type:"rtcState",action:o,body:e}})},this.client=new t({roomName:a,token:r,userId:l,appId:c,server:i,rtcConfig:this.rtcConfig,callback:{onRemoteVideoConnected:(t,o)=>{if(!o&&!this.haveVideoOn){let t=setTimeout((()=>{this.restartCount<3?(this.restartCount=++this.restartCount,this.restartRtc?.(e)):(this.restartCount=0,this.closeRtc()),clearTimeout(t)}),500)}if(o){const t=document.getElementById("remotevideo500");t.muted=!1;let e=t.play();void 0!==e&&e.catch((()=>{t.muted=!0,t.play().catch((e=>{!this.closeLog&&console.info("videoElement play error",e),S?.(t),V&&V({status:s.statusEnum.DH_LIB_ERROR,content:{type:s.errorTypeEnum.LOCAL_VIDEO_ERROR}})})),V&&V({status:s.statusEnum.DH_LIB_STATUS,content:{type:s.errorTypeEnum.LOCAL_VIDEO_MUTED}})}))}!this.closeLog&&console.info("remoteVideoConnected",t,o,this.restartCount),this.rtcStateCallback?.({action:"remoteVideoConnected",body:{id:t,connected:o,restartCount:this.restartCount}}),n(v)&&v(t,o)},onRemoteVideoOn:t=>{this.haveVideoOn=!0,!this.closeLog&&console.info("remotevideoon by id: ",t),this.timeoutEvent.clear();const e=document.querySelector("#starlingRtcContainer")?.lastChild;e&&(e.style.display="none"),this.rtcStateCallback?.({action:"remotevideoon",body:t}),V&&V({status:s.statusEnum.DH_LIB_OPEN}),n(g)&&g(t)},onRemoteMediaState:(t,e,o)=>{!this.closeLog&&console.info("remoteMediaState",t,e,o),this.rtcStateCallback?.({action:"remoteMediaState",body:{id:t,medium:e,connected:o}}),n(E)&&E(t,e,o)},onLocalVideoConnected:t=>{!this.closeLog&&console.info("localVideoConnected",t),this.rtcStateCallback?.({action:"localVideoConnected",body:{connected:t}}),n(y)&&y(t)},onRemotedata:t=>{if(this.rtcConfig?.usingdatachannel){const e=o.parse(t);!this.closeLog&&console.info("RTC - receive:",e),n(d)&&d(e)}},onLocalStream:(t,e)=>{!this.closeLog&&console.info("rtc - onlocalstream by name: "+e),this.rtcStateCallback?.({action:"onlocalstream",body:{stream:t,name:e}}),n(h)&&h(t,e)},onLocalVideoPublished:()=>{!this.closeLog&&console.info("LocalVideoPublished 本地视频发布成功"),this.rtcStateCallback?.({action:"localvideopublished_ok",body:!0}),n(m)&&m()},onLocalVideoPublishing:()=>{!this.closeLog&&console.info("LocalVideoPublishing 本地视频发布成功"),this.rtcStateCallback?.({action:"localvideopublishing",body:!0}),n(C)&&C()},onRemoteVideoComing:t=>{!this.closeLog&&console.info("remotevideocoming",t),this.rtcStateCallback?.({action:"remotevideocoming",body:t}),n(u)&&u(t)},onRemoteVideoLoading:t=>{!this.closeLog&&console.info("remotevideoloading by id: ",t),this.rtcStateCallback?.({action:"remotevideoloading",body:t}),n(L)&&L(t)},onRemoteVideoOff:t=>{!this.closeLog&&console.info("remotevideooff: ",t),this.isRtcVideoOn=!1,this.rtcStateCallback?.({action:"remotevideooff",body:t}),V&&V({status:s.statusEnum.DH_LIB_CLOSE}),n(b)&&b(t),this.timeoutEvent.start()},onSuccess:()=>{!this.closeLog&&console.info("rtc - success"),this.rtcStateCallback?.({action:"success",body:!0}),n(R)&&R()},onError:t=>{this.isRtcVideoOn=!1,!this.closeLog&&console.error("rtc - error:",t),this.rtcStateCallback?.({action:"error",body:t}),V&&V({status:s.statusEnum.DH_LIB_ERROR,content:{type:s.errorTypeEnum.RTC_ERROR}}),n(f)&&f(t),(t.includes("Lost connection to the server")||t.includes("Is the server down"))&&this.restartRtc?.(e)}}})}};closeRtc=()=>{this.timeoutEvent.clear(),clearTimeout(this.reopenTimer),this.client?.destroy(),this.restarting=!1};restartRtc=t=>{!this.restarting&&this.bizConfig?.autoReConnect&&(this.rtcStateCallback?.({action:"restartRtc",body:t}),this.restarting=!0,this.closeRtc?.(),this.reopenTimer=setTimeout((()=>{!this.closeLog&&console.error("拉流失败,开始重启"),this.restarting=!1,this.openRtc(t)}),2e3))}};
|
package/cjs/Client.d.ts
CHANGED
|
@@ -24,13 +24,14 @@ export default class DhRealtimeHuman {
|
|
|
24
24
|
createServer: (sessionId?: string) => void;
|
|
25
25
|
checkHumanInstansce: () => void;
|
|
26
26
|
sendMessage: (message: DHServerInterface, listener: RenderCallback | null) => Promise<void> | undefined;
|
|
27
|
+
interrupt: () => Promise<void>;
|
|
27
28
|
textRender: (renderData: {
|
|
28
29
|
requestId: string;
|
|
29
30
|
body: string;
|
|
30
31
|
onCallbackMsg: RenderCallback;
|
|
31
32
|
}) => void;
|
|
32
33
|
textStreamRender: (renderData: {
|
|
33
|
-
requestId
|
|
34
|
+
requestId?: string;
|
|
34
35
|
body: string;
|
|
35
36
|
onCallbackMsg: RenderCallback;
|
|
36
37
|
}) => void;
|
|
@@ -39,6 +40,7 @@ export default class DhRealtimeHuman {
|
|
|
39
40
|
onCallbackMsg: RenderCallback;
|
|
40
41
|
}) => void;
|
|
41
42
|
audioStreamRender: (renderData: {
|
|
43
|
+
requestId?: string;
|
|
42
44
|
body: string;
|
|
43
45
|
onCallbackMsg: RenderCallback;
|
|
44
46
|
}) => void;
|
package/cjs/Client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@bddh/starling-json"),t=require("lodash/isEmpty"),a=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@bddh/starling-json"),t=require("lodash/isEmpty"),a=require("lodash/omit"),n=require("lodash/pick"),s=require("uuid"),r=require("./interface.js"),o=require("./Server.js"),i=require("./BrtcClient.js"),c=require("./DomControl.js"),d=require("./Cutout.js");exports.default=class{token;appKey;appId;connectParams;renderParams;onDigitalHumanCallback;dhServer;rtcServer;rtcConnectParams;cutoutInstance;isHuawei=c.checkIsHuawei();constructor(e){const{wrapperId:a,token:n,appKey:s,appId:u,connectParams:m,renderParams:l,rtcConnectParams:h,brtcParams:p,onDigitalHumanCallback:I}=e;this.token=n,this.appKey=s,this.appId=u,this.connectParams=m,this.renderParams=l;const{fullStatus:g,closeLog:C}=l;this.onDigitalHumanCallback=e=>{const{status:t}=e;t!==r.statusEnum.DH_LIB_FULL_STATUS?I&&I(e):g&&I&&I(e)},this.dhServer=new o.default("wss://persona.baidu.com:8850/cloud/digital-human-demonstration");const{playerWrapper:v}=c.createHumanDom({autoChromaKey:!!l.autoChromaKey})||{},y=document.getElementById(a);y||console.error("dom with wrapperId is not find"),v&&y?.appendChild(v),this.rtcServer=new i.default({closeLog:C,videoWrapperId:c.RTC_VIDEO_ID,rtcConfig:{remotevideoviewid:a,showvideobps:!1,usingvideo:!1,usingaudio:!1,aspublisher:!1,usingdatachannel:!0,autoplaymuted:!1,...p},bizConfig:{},rtcCallback:{onRemoteVideoComing:this.onRemoteVideoComing,onDigitalHumanCallback:this.onDigitalHumanCallback}}),this.cutoutInstance=new d.default({sourceId:c.RTC_VIDEO_ID}),t(h)||(this.rtcConnectParams=h,this.rtcServer.openRtc(h))}onRemoteVideoComing=e=>{this.rtcConnectParams&&this.rtcConnectParams.feedId&&e===+this.rtcConnectParams.feedId&&this.rtcServer?.client?.subscribeStreaming("remotevideo500",+this.rtcConnectParams.feedId)};onRemoteVideoOn=()=>{setTimeout((async()=>{const e=document.getElementById(c.RTC_VIDEO_ID);if(await(this.cutoutInstance?.updateSource?.(c.RTC_VIDEO_ID)),e){e.setAttribute?.("data-playing","true");const{videoWidth:t,videoHeight:a}=e,n=document.getElementById(c.DEFAULT_CANVAS_ID),s=n.getContext("2d");n&&s&&(n.width=t,n.height=a,s.drawImage(e,0,0,t,a))}}),100)};connectListener=t=>{const{code:a,body:n}=t;if(0===a){const t=e.parse(n),{rtcServerUrl:a,appId:s,clientToken:r,roomName:o,clientId:i,feedId:c,chargeId:d}=t;this.rtcConnectParams={server:a,appId:s,token:r,roomName:o,userId:i,feedId:c,chargeId:d},s&&o&&this.rtcServer?.openRtc(this.rtcConnectParams)}};createServer=e=>{this.dhServer?.createSocket({token:this.token,appKey:this.appKey,appId:this.appId,...e?{sessionId:e}:{},...n(this.connectParams,r.CONNECT_MAIN_KEY),parameters:a(this.connectParams,r.CONNECT_MAIN_KEY),onConnect:this.connectListener,onDigitalHumanCallback:this.onDigitalHumanCallback})};checkHumanInstansce=()=>{this.dhServer||console.warn("请先初始化数字人示例")};sendMessage=(e,t)=>this.dhServer?.sendMessage(e,t);interrupt=async()=>new Promise((e=>{this.dhServer?.sendMessage({requestId:s.v4(),action:"TEXT_RENDER",body:"<interrupt></interrupt>",clientTs:(new Date).getTime()},(()=>e()))}));textRender=e=>{const{requestId:t,body:a,onCallbackMsg:n}=e;this.checkHumanInstansce(),this.dhServer?.sendMessage({requestId:t||s.v4(),action:"TEXT_RENDER",body:a,clientTs:(new Date).getTime()},n)};textStreamRender=t=>{const{requestId:a,body:n,onCallbackMsg:r}=t,{first:o}=e.parse(n);this.checkHumanInstansce(),this.dhServer?.sendMessage({requestId:a||s.v4(),action:"TEXT_STREAM_RENDER",body:n,clientTs:(new Date).getTime()},o?r:null)};audioRender=e=>{const{body:t,onCallbackMsg:a}=e;this.checkHumanInstansce(),this.dhServer?.sendMessage({requestId:s.v4(),action:"AUDIO_RENDER",body:t,clientTs:(new Date).getTime()},a)};audioStreamRender=e=>{const{requestId:t,body:a,onCallbackMsg:n}=e;this.checkHumanInstansce(),this.dhServer?.sendMessage({requestId:t||s.v4(),action:"AUDIO_STREAM_RENDER",body:a,clientTs:(new Date).getTime()},n)};destory=async()=>{await(this.dhServer?.closeSocket()),this.rtcServer?.closeRtc(),c.removeHumanDom(),this.dhServer=null,this.rtcServer=null};pauseHuman=()=>c.playHumanVideo(!1);playHuman=()=>c.playHumanVideo(!0);muteHuman=()=>c.muteHumanVideo(!0);unMuteHuman=()=>{const e=c.muteHumanVideo(!1);try{return this.isHuawei?(e.pause(),e.play()):e.paused&&e.play()}catch(e){console.log(e)}}};
|
package/cjs/DomControl.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t="starling-cutout-canvas",e="cloud-brtc-player-wrapper",n="remotevideo500";exports.DEFAULT_CANVAS_ID=t,exports.HUMAN_WRAPPER_ID=e,exports.RTC_VIDEO_ID=n,exports.checkIsHuawei=function(){const t=navigator.userAgent||navigator.vendor;return/huawei/i.test(t)||/honor/i.test(t)},exports.createHumanDom=function(o){const{id:i=n,autoChromaKey:r=!1,autoplay:a=!0}=o;if(document.getElementById(i))return console.error(`DOM with id "${i}" already exists.`),null;const s=document.createElement("div");s.className=e,s.id=e,s.style.position="relative";const u=document.createElement("video");u.id=i,u.width=0,u.height=0,u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("data-playing","true"),u.setAttribute("playsinline","");const d=document.createElement("canvas");return d.id=t,Object.assign(d.style,{position:"absolute",top:"0",left:"0",height:"100%",width:"100%",zIndex:"1",display:r?"block":"none"}),a&&u.setAttribute("autoplay",""),r&&(u.style.visibility="hidden"),s.appendChild(u),s.appendChild(d),{playerWrapper:s,video:u}},exports.muteHumanVideo=function(t){const e=document.getElementById(n);return e&&(e.muted=t),e},exports.playHumanVideo=function(t){const e=document.getElementById(n);try{if(e)return t?e.play():e.pause()}catch(t){console.info(t)}},exports.removeHumanDom=function(){const t=document.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)};
|
package/cjs/Server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("uuid"),t=require("@bddh/starling-web-socket/es/create-web-socket"),s=require("./interface.js");exports.default=class{dhServerSocket=null;socketClosingPromise=null;url;firstConnect=!0;connectParams=null;constructor(e){this.url=e}createSocket=async
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("uuid"),t=require("@bddh/starling-web-socket/es/create-web-socket"),s=require("lodash/pick"),n=require("./interface.js");exports.default=class{dhServerSocket=null;socketClosingPromise=null;url;firstConnect=!0;connectParams=null;constructor(e){this.url=e}createSocket=async s=>{this.connectParams=s;const{token:o,sessionId:r,onConnect:c,onDigitalHumanCallback:i}=s;return this.socketClosingPromise&&await this.socketClosingPromise,this.dhServerSocket&&await this.closeSocket(),new Promise(((s,a)=>{const u=t.createWebSocket(this.url,{reopen:!0,keepAlive:"heartbeat",combine:(e,t)=>e?.requestId===t?.requestId,onOpen:()=>{if(this.dhServerSocket=u,r&&this.firstConnect)return u.request({action:"RE_CONNECT",requestId:e.v4(),body:JSON.stringify({token:o,sessionId:r})}).on(((e,t)=>{c(e),0!==e.code&&(t(),this.handleConnect()),s(u)})),void(this.firstConnect=!1);this.handleConnect()},onClose:()=>{this.dhServerSocket=null,this.socketClosingPromise=null},onError:e=>{a(e)}});u.onReadyStateChange((e=>{-1===e&&i&&i({status:n.statusEnum.DH_LIB_INIT}),i&&i({status:n.statusEnum.DH_LIB_FULL_STATUS,content:{type:"wsState",readyState:e,body:n.WS_STATUS_MAP[e]}})})),u.onMessage((e=>{const{action:t}=e;[n.errorTypeEnum.TIMEOUT_EXIT,n.errorTypeEnum.DISCONNECT_ALERT].includes(t)&&i&&i({status:n.statusEnum.DH_LIB_STATUS,content:{type:t}})})),u.open()}))};closeSocket=async()=>{this.dhServerSocket&&(this.socketClosingPromise=this.dhServerSocket.close(),await this.socketClosingPromise,this.dhServerSocket=null)};handleConnect=async()=>{if(!this.connectParams)return;const{appId:t,appKey:o,token:r,parameters:c,onConnect:i}=this.connectParams;(t||o||r)&&this.dhServerSocket?.request({action:"CONNECT",clientTs:(new Date).getTime(),requestId:e.v4(),body:JSON.stringify({token:r,appId:t,appKey:o,...s(this.connectParams,n.CONNECT_MAIN_KEY),parameters:{...c,...c?.extraParameters&&c?.extraParameters||{}}})}).on(((e,t)=>{i(e),0!==e.code&&t()}))};async sendMessage(e,t){try{this.dhServerSocket&&this.dhServerSocket?.request(e).on((e=>{t&&t(e)}))}catch(s){t&&t({code:-11,body:null,action:"RENDER_ERROR",requestId:e.requestId,message:JSON.stringify(s)})}}};
|
package/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Client.js"),r=require("./interface.js");exports.default=e.default,exports.WS_STATUS_MAP=r.WS_STATUS_MAP,Object.defineProperty(exports,"errorTypeEnum",{enumerable:!0,get:function(){return r.errorTypeEnum}}),Object.defineProperty(exports,"statusEnum",{enumerable:!0,get:function(){return r.statusEnum}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Client.js"),r=require("./interface.js");exports.default=e.default,exports.CONNECT_MAIN_KEY=r.CONNECT_MAIN_KEY,exports.WS_STATUS_MAP=r.WS_STATUS_MAP,Object.defineProperty(exports,"errorTypeEnum",{enumerable:!0,get:function(){return r.errorTypeEnum}}),Object.defineProperty(exports,"statusEnum",{enumerable:!0,get:function(){return r.statusEnum}});
|
package/cjs/interface.d.ts
CHANGED
|
@@ -23,7 +23,20 @@ export interface ConnectParamsType {
|
|
|
23
23
|
inactiveDisconnectSec?: number;
|
|
24
24
|
preAlertSec?: number;
|
|
25
25
|
x264BitRate?: number;
|
|
26
|
+
backgroundImageUrl?: string;
|
|
27
|
+
projectId?: string;
|
|
28
|
+
characterConfigId?: string;
|
|
29
|
+
selectors?: any;
|
|
30
|
+
figureName?: string;
|
|
31
|
+
configVersion?: string;
|
|
32
|
+
extraInfo?: any;
|
|
33
|
+
roomName?: string;
|
|
34
|
+
paintSubtitleOnPicture?: boolean;
|
|
35
|
+
h5Embedded?: boolean;
|
|
36
|
+
paintWidgetOnPicture?: boolean;
|
|
37
|
+
extraParameters?: any;
|
|
26
38
|
}
|
|
39
|
+
export declare const CONNECT_MAIN_KEY: string[];
|
|
27
40
|
export interface RenderParamsType {
|
|
28
41
|
chromaEffects?: object;
|
|
29
42
|
autoChromaKey?: boolean;
|
|
@@ -83,5 +96,6 @@ export interface DhRealtimeHumanType {
|
|
|
83
96
|
connectParams: ConnectParamsType;
|
|
84
97
|
renderParams: RenderParamsType;
|
|
85
98
|
rtcConnectParams?: RtcConnectionType;
|
|
99
|
+
brtcParams?: any;
|
|
86
100
|
onDigitalHumanCallback: (data: CallbackMsgType) => void;
|
|
87
101
|
}
|
package/cjs/interface.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _,E;exports.statusEnum=void 0,(_=exports.statusEnum||(exports.statusEnum={})).DH_LIB_INIT="DH_LIB_INIT",_.DH_LIB_WS_SUCCESS="DH_LIB_WS_SUCCESS",_.DH_LIB_OPEN="DH_LIB_OPEN",_.DH_LIB_STATUS="DH_LIB_STATUS",_.DH_LIB_CLOSE="DH_LIB_CLOSE",_.DH_LIB_ERROR="DH_LIB_ERROR",_.DH_LIB_WARNING="DH_LIB_WARNING",_.DH_LIB_FULL_STATUS="DH_LIB_FULL_STATUS",exports.errorTypeEnum=void 0,(E=exports.errorTypeEnum||(exports.errorTypeEnum={})).CONNECT_ERROR="CONNECT_ERROR",E.DISCONNECT_ALERT="DISCONNECT_ALERT",E.TIMEOUT_EXIT="TIMEOUT_EXIT",E.LOCAL_VIDEO_MUTED="LOCAL_VIDEO_MUTED",E.LOCAL_VIDEO_ERROR="LOCAL_VIDEO_ERROR",E.RTC_ERROR="RTC_ERROR";exports.WS_STATUS_MAP={"-1":"UNINSTANTIATED",0:"CONNECTING",1:"OPEN",2:"CLOSING",3:"CLOSED"};
|
|
1
|
+
"use strict";var _,E;exports.statusEnum=void 0,(_=exports.statusEnum||(exports.statusEnum={})).DH_LIB_INIT="DH_LIB_INIT",_.DH_LIB_WS_SUCCESS="DH_LIB_WS_SUCCESS",_.DH_LIB_OPEN="DH_LIB_OPEN",_.DH_LIB_STATUS="DH_LIB_STATUS",_.DH_LIB_CLOSE="DH_LIB_CLOSE",_.DH_LIB_ERROR="DH_LIB_ERROR",_.DH_LIB_WARNING="DH_LIB_WARNING",_.DH_LIB_FULL_STATUS="DH_LIB_FULL_STATUS",exports.errorTypeEnum=void 0,(E=exports.errorTypeEnum||(exports.errorTypeEnum={})).CONNECT_ERROR="CONNECT_ERROR",E.DISCONNECT_ALERT="DISCONNECT_ALERT",E.TIMEOUT_EXIT="TIMEOUT_EXIT",E.LOCAL_VIDEO_MUTED="LOCAL_VIDEO_MUTED",E.LOCAL_VIDEO_ERROR="LOCAL_VIDEO_ERROR",E.RTC_ERROR="RTC_ERROR";exports.CONNECT_MAIN_KEY=["projectId","characterConfigId","configVersion","selectors","figureName"],exports.WS_STATUS_MAP={"-1":"UNINSTANTIATED",0:"CONNECTING",1:"OPEN",2:"CLOSING",3:"CLOSED"};
|
package/es/BrtcClient.d.ts
CHANGED
|
@@ -66,7 +66,6 @@ export interface RtcCallback {
|
|
|
66
66
|
onDigitalHumanCallback: (data: CallbackMsgType) => void;
|
|
67
67
|
}
|
|
68
68
|
interface BrtcClientType {
|
|
69
|
-
brtcParams: any;
|
|
70
69
|
videoWrapperId: string;
|
|
71
70
|
bizConfig: BizConfig;
|
|
72
71
|
closeLog?: boolean;
|
|
@@ -78,7 +77,6 @@ interface BrtcClientType {
|
|
|
78
77
|
declare class BrtcClient {
|
|
79
78
|
client?: BRtcInstance;
|
|
80
79
|
isRtcVideoOn: boolean;
|
|
81
|
-
private readonly brtcParams?;
|
|
82
80
|
private rtcConnection;
|
|
83
81
|
private readonly rtcConfig?;
|
|
84
82
|
private readonly bizConfig?;
|
package/es/BrtcClient.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"@bddh/starling-brtc";import{TimeoutController as o}from"@bddh/starling-timeout-controller";import e from"@bddh/starling-json";import i from"lodash/isEmpty";import n from"lodash/isFunction";import{statusEnum as c,errorTypeEnum as s}from"./interface.js";class r{client;isRtcVideoOn=!1;
|
|
1
|
+
import t from"@bddh/starling-brtc";import{TimeoutController as o}from"@bddh/starling-timeout-controller";import e from"@bddh/starling-json";import i from"lodash/isEmpty";import n from"lodash/isFunction";import{statusEnum as c,errorTypeEnum as s}from"./interface.js";class r{client;isRtcVideoOn=!1;rtcConnection;rtcConfig;bizConfig;rtcCallback;restarting=!1;timeoutEvent;reopenTimer;restartCount=0;closeLog=!0;haveVideoOn=!1;rtcStateCallback=null;constructor(t){const{rtcConnection:e,rtcConfig:i,closeLog:n=!0,rtcCallback:c}=t;this.rtcConnection=e,this.rtcConfig=i,this.rtcCallback=c,this.closeLog=n,this.timeoutEvent=new o(6e4,(()=>{if(!this.rtcConnection)return!this.closeLog&&console.warn("remotevideoon事件超时, rtcConnectionRef is null");this.timeoutEvent.clear(),this.restartRtc?.(this.rtcConnection)}))}openRtc=o=>{if(this.restarting)!this.closeLog&&console.warn("rtc restarting");else if(o&&(this.rtcConnection=o),this.rtcConnection&&!i(this.rtcConnection)){const{server:i,appId:r,token:a,roomName:l,userId:d}=this.rtcConnection,{onRemotedata:h,onLocalStream:m,onRemoteVideoComing:C,onLocalVideoPublished:u,onLocalVideoPublishing:g,onRemoteVideoOn:b,onRemoteVideoOff:L,onRemoteVideoLoading:f,onSuccess:R,onError:y,onLocalVideoConnected:S,onRemoteVideoConnected:V,onRemoteMediaState:v,onPlayingError:p,onDigitalHumanCallback:k}=this.rtcCallback||{};this.timeoutEvent.start(),this.rtcStateCallback=t=>{const{body:o,action:e}=t;k&&k({status:c.DH_LIB_FULL_STATUS,content:{type:"rtcState",action:e,body:o}})},this.client=new t({roomName:l,token:a,userId:d,appId:r,server:i,rtcConfig:this.rtcConfig,callback:{onRemoteVideoConnected:(t,e)=>{if(!e&&!this.haveVideoOn){let t=setTimeout((()=>{this.restartCount<3?(this.restartCount=++this.restartCount,this.restartRtc?.(o)):(this.restartCount=0,this.closeRtc()),clearTimeout(t)}),500)}if(e){const t=document.getElementById("remotevideo500");t.muted=!1;let o=t.play();void 0!==o&&o.catch((()=>{t.muted=!0,t.play().catch((o=>{!this.closeLog&&console.info("videoElement play error",o),p?.(t),k&&k({status:c.DH_LIB_ERROR,content:{type:s.LOCAL_VIDEO_ERROR}})})),k&&k({status:c.DH_LIB_STATUS,content:{type:s.LOCAL_VIDEO_MUTED}})}))}!this.closeLog&&console.info("remoteVideoConnected",t,e,this.restartCount),this.rtcStateCallback?.({action:"remoteVideoConnected",body:{id:t,connected:e,restartCount:this.restartCount}}),n(V)&&V(t,e)},onRemoteVideoOn:t=>{this.haveVideoOn=!0,!this.closeLog&&console.info("remotevideoon by id: ",t),this.timeoutEvent.clear();const o=document.querySelector("#starlingRtcContainer")?.lastChild;o&&(o.style.display="none"),this.rtcStateCallback?.({action:"remotevideoon",body:t}),k&&k({status:c.DH_LIB_OPEN}),n(b)&&b(t)},onRemoteMediaState:(t,o,e)=>{!this.closeLog&&console.info("remoteMediaState",t,o,e),this.rtcStateCallback?.({action:"remoteMediaState",body:{id:t,medium:o,connected:e}}),n(v)&&v(t,o,e)},onLocalVideoConnected:t=>{!this.closeLog&&console.info("localVideoConnected",t),this.rtcStateCallback?.({action:"localVideoConnected",body:{connected:t}}),n(S)&&S(t)},onRemotedata:t=>{if(this.rtcConfig?.usingdatachannel){const o=e.parse(t);!this.closeLog&&console.info("RTC - receive:",o),n(h)&&h(o)}},onLocalStream:(t,o)=>{!this.closeLog&&console.info("rtc - onlocalstream by name: "+o),this.rtcStateCallback?.({action:"onlocalstream",body:{stream:t,name:o}}),n(m)&&m(t,o)},onLocalVideoPublished:()=>{!this.closeLog&&console.info("LocalVideoPublished 本地视频发布成功"),this.rtcStateCallback?.({action:"localvideopublished_ok",body:!0}),n(u)&&u()},onLocalVideoPublishing:()=>{!this.closeLog&&console.info("LocalVideoPublishing 本地视频发布成功"),this.rtcStateCallback?.({action:"localvideopublishing",body:!0}),n(g)&&g()},onRemoteVideoComing:t=>{!this.closeLog&&console.info("remotevideocoming",t),this.rtcStateCallback?.({action:"remotevideocoming",body:t}),n(C)&&C(t)},onRemoteVideoLoading:t=>{!this.closeLog&&console.info("remotevideoloading by id: ",t),this.rtcStateCallback?.({action:"remotevideoloading",body:t}),n(f)&&f(t)},onRemoteVideoOff:t=>{!this.closeLog&&console.info("remotevideooff: ",t),this.isRtcVideoOn=!1,this.rtcStateCallback?.({action:"remotevideooff",body:t}),k&&k({status:c.DH_LIB_CLOSE}),n(L)&&L(t),this.timeoutEvent.start()},onSuccess:()=>{!this.closeLog&&console.info("rtc - success"),this.rtcStateCallback?.({action:"success",body:!0}),n(R)&&R()},onError:t=>{this.isRtcVideoOn=!1,!this.closeLog&&console.error("rtc - error:",t),this.rtcStateCallback?.({action:"error",body:t}),k&&k({status:c.DH_LIB_ERROR,content:{type:s.RTC_ERROR}}),n(y)&&y(t),(t.includes("Lost connection to the server")||t.includes("Is the server down"))&&this.restartRtc?.(o)}}})}};closeRtc=()=>{this.timeoutEvent.clear(),clearTimeout(this.reopenTimer),this.client?.destroy(),this.restarting=!1};restartRtc=t=>{!this.restarting&&this.bizConfig?.autoReConnect&&(this.rtcStateCallback?.({action:"restartRtc",body:t}),this.restarting=!0,this.closeRtc?.(),this.reopenTimer=setTimeout((()=>{!this.closeLog&&console.error("拉流失败,开始重启"),this.restarting=!1,this.openRtc(t)}),2e3))}}export{r as default};
|
package/es/Client.d.ts
CHANGED
|
@@ -24,13 +24,14 @@ export default class DhRealtimeHuman {
|
|
|
24
24
|
createServer: (sessionId?: string) => void;
|
|
25
25
|
checkHumanInstansce: () => void;
|
|
26
26
|
sendMessage: (message: DHServerInterface, listener: RenderCallback | null) => Promise<void> | undefined;
|
|
27
|
+
interrupt: () => Promise<void>;
|
|
27
28
|
textRender: (renderData: {
|
|
28
29
|
requestId: string;
|
|
29
30
|
body: string;
|
|
30
31
|
onCallbackMsg: RenderCallback;
|
|
31
32
|
}) => void;
|
|
32
33
|
textStreamRender: (renderData: {
|
|
33
|
-
requestId
|
|
34
|
+
requestId?: string;
|
|
34
35
|
body: string;
|
|
35
36
|
onCallbackMsg: RenderCallback;
|
|
36
37
|
}) => void;
|
|
@@ -39,6 +40,7 @@ export default class DhRealtimeHuman {
|
|
|
39
40
|
onCallbackMsg: RenderCallback;
|
|
40
41
|
}) => void;
|
|
41
42
|
audioStreamRender: (renderData: {
|
|
43
|
+
requestId?: string;
|
|
42
44
|
body: string;
|
|
43
45
|
onCallbackMsg: RenderCallback;
|
|
44
46
|
}) => void;
|
package/es/Client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@bddh/starling-json";import t from"lodash/isEmpty";import{v4 as a}from"uuid";import{statusEnum as
|
|
1
|
+
import e from"@bddh/starling-json";import t from"lodash/isEmpty";import n from"lodash/omit";import s from"lodash/pick";import{v4 as a}from"uuid";import{statusEnum as r,CONNECT_MAIN_KEY as o}from"./interface.js";import i from"./Server.js";import c from"./BrtcClient.js";import{checkIsHuawei as d,createHumanDom as m,RTC_VIDEO_ID as h,DEFAULT_CANVAS_ID as u,removeHumanDom as l,playHumanVideo as p,muteHumanVideo as g}from"./DomControl.js";import I from"./Cutout.js";class C{token;appKey;appId;connectParams;renderParams;onDigitalHumanCallback;dhServer;rtcServer;rtcConnectParams;cutoutInstance;isHuawei=d();constructor(e){const{wrapperId:n,token:s,appKey:a,appId:o,connectParams:d,renderParams:u,rtcConnectParams:l,brtcParams:p,onDigitalHumanCallback:g}=e;this.token=s,this.appKey=a,this.appId=o,this.connectParams=d,this.renderParams=u;const{fullStatus:C,closeLog:S}=u;this.onDigitalHumanCallback=e=>{const{status:t}=e;t!==r.DH_LIB_FULL_STATUS?g&&g(e):C&&g&&g(e)},this.dhServer=new i("wss://persona.baidu.com:8850/cloud/digital-human-demonstration");const{playerWrapper:y}=m({autoChromaKey:!!u.autoChromaKey})||{},b=document.getElementById(n);b||console.error("dom with wrapperId is not find"),y&&b?.appendChild(y),this.rtcServer=new c({closeLog:S,videoWrapperId:h,rtcConfig:{remotevideoviewid:n,showvideobps:!1,usingvideo:!1,usingaudio:!1,aspublisher:!1,usingdatachannel:!0,autoplaymuted:!1,...p},bizConfig:{},rtcCallback:{onRemoteVideoComing:this.onRemoteVideoComing,onDigitalHumanCallback:this.onDigitalHumanCallback}}),this.cutoutInstance=new I({sourceId:h}),t(l)||(this.rtcConnectParams=l,this.rtcServer.openRtc(l))}onRemoteVideoComing=e=>{this.rtcConnectParams&&this.rtcConnectParams.feedId&&e===+this.rtcConnectParams.feedId&&this.rtcServer?.client?.subscribeStreaming("remotevideo500",+this.rtcConnectParams.feedId)};onRemoteVideoOn=()=>{setTimeout((async()=>{const e=document.getElementById(h);if(await(this.cutoutInstance?.updateSource?.(h)),e){e.setAttribute?.("data-playing","true");const{videoWidth:t,videoHeight:n}=e,s=document.getElementById(u),a=s.getContext("2d");s&&a&&(s.width=t,s.height=n,a.drawImage(e,0,0,t,n))}}),100)};connectListener=t=>{const{code:n,body:s}=t;if(0===n){const t=e.parse(s),{rtcServerUrl:n,appId:a,clientToken:r,roomName:o,clientId:i,feedId:c,chargeId:d}=t;this.rtcConnectParams={server:n,appId:a,token:r,roomName:o,userId:i,feedId:c,chargeId:d},a&&o&&this.rtcServer?.openRtc(this.rtcConnectParams)}};createServer=e=>{this.dhServer?.createSocket({token:this.token,appKey:this.appKey,appId:this.appId,...e?{sessionId:e}:{},...s(this.connectParams,o),parameters:n(this.connectParams,o),onConnect:this.connectListener,onDigitalHumanCallback:this.onDigitalHumanCallback})};checkHumanInstansce=()=>{this.dhServer||console.warn("请先初始化数字人示例")};sendMessage=(e,t)=>this.dhServer?.sendMessage(e,t);interrupt=async()=>new Promise((e=>{this.dhServer?.sendMessage({requestId:a(),action:"TEXT_RENDER",body:"<interrupt></interrupt>",clientTs:(new Date).getTime()},(()=>e()))}));textRender=e=>{const{requestId:t,body:n,onCallbackMsg:s}=e;this.checkHumanInstansce(),this.dhServer?.sendMessage({requestId:t||a(),action:"TEXT_RENDER",body:n,clientTs:(new Date).getTime()},s)};textStreamRender=t=>{const{requestId:n,body:s,onCallbackMsg:r}=t,{first:o}=e.parse(s);this.checkHumanInstansce(),this.dhServer?.sendMessage({requestId:n||a(),action:"TEXT_STREAM_RENDER",body:s,clientTs:(new Date).getTime()},o?r:null)};audioRender=e=>{const{body:t,onCallbackMsg:n}=e;this.checkHumanInstansce(),this.dhServer?.sendMessage({requestId:a(),action:"AUDIO_RENDER",body:t,clientTs:(new Date).getTime()},n)};audioStreamRender=e=>{const{requestId:t,body:n,onCallbackMsg:s}=e;this.checkHumanInstansce(),this.dhServer?.sendMessage({requestId:t||a(),action:"AUDIO_STREAM_RENDER",body:n,clientTs:(new Date).getTime()},s)};destory=async()=>{await(this.dhServer?.closeSocket()),this.rtcServer?.closeRtc(),l(),this.dhServer=null,this.rtcServer=null};pauseHuman=()=>p(!1);playHuman=()=>p(!0);muteHuman=()=>g(!0);unMuteHuman=()=>{const e=g(!1);try{return this.isHuawei?(e.pause(),e.play()):e.paused&&e.play()}catch(e){console.log(e)}}}export{C as default};
|
package/es/DomControl.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t="starling-cutout-canvas",e="cloud-brtc-player-wrapper",n="remotevideo500";function i(i){const{id:o=n,autoChromaKey:r=!1,autoplay:a=!0}=i;if(document.getElementById(o))return console.error(`DOM with id "${o}" already exists.`),null;const d=document.createElement("div");d.className=e,d.id=e,d.style.position="relative";const s=document.createElement("video");s.id=o,s.width=0,s.height=0,s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("data-playing","true"),s.setAttribute("playsinline","");const
|
|
1
|
+
const t="starling-cutout-canvas",e="cloud-brtc-player-wrapper",n="remotevideo500";function i(i){const{id:o=n,autoChromaKey:r=!1,autoplay:a=!0}=i;if(document.getElementById(o))return console.error(`DOM with id "${o}" already exists.`),null;const d=document.createElement("div");d.className=e,d.id=e,d.style.position="relative";const s=document.createElement("video");s.id=o,s.width=0,s.height=0,s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("data-playing","true"),s.setAttribute("playsinline","");const c=document.createElement("canvas");return c.id=t,Object.assign(c.style,{position:"absolute",top:"0",left:"0",height:"100%",width:"100%",zIndex:"1",display:r?"block":"none"}),a&&s.setAttribute("autoplay",""),r&&(s.style.visibility="hidden"),d.appendChild(s),d.appendChild(c),{playerWrapper:d,video:s}}function o(){const t=document.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)}function r(t){const e=document.getElementById(n);return e&&(e.muted=t),e}function a(t){const e=document.getElementById(n);try{if(e)return t?e.play():e.pause()}catch(t){console.info(t)}}function d(){const t=navigator.userAgent||navigator.vendor;return/huawei/i.test(t)||/honor/i.test(t)}export{t as DEFAULT_CANVAS_ID,e as HUMAN_WRAPPER_ID,n as RTC_VIDEO_ID,d as checkIsHuawei,i as createHumanDom,r as muteHumanVideo,a as playHumanVideo,o as removeHumanDom};
|
package/es/Server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v4 as e}from"uuid";import{createWebSocket as t}from"@bddh/starling-web-socket/es/create-web-socket";import{statusEnum as
|
|
1
|
+
import{v4 as e}from"uuid";import{createWebSocket as t}from"@bddh/starling-web-socket/es/create-web-socket";import s from"lodash/pick";import{statusEnum as o,WS_STATUS_MAP as n,errorTypeEnum as r,CONNECT_MAIN_KEY as i}from"./interface.js";class c{dhServerSocket=null;socketClosingPromise=null;url;firstConnect=!0;connectParams=null;constructor(e){this.url=e}createSocket=async s=>{this.connectParams=s;const{token:i,sessionId:c,onConnect:a,onDigitalHumanCallback:h}=s;return this.socketClosingPromise&&await this.socketClosingPromise,this.dhServerSocket&&await this.closeSocket(),new Promise(((s,d)=>{const l=t(this.url,{reopen:!0,keepAlive:"heartbeat",combine:(e,t)=>e?.requestId===t?.requestId,onOpen:()=>{if(this.dhServerSocket=l,c&&this.firstConnect)return l.request({action:"RE_CONNECT",requestId:e(),body:JSON.stringify({token:i,sessionId:c})}).on(((e,t)=>{a(e),0!==e.code&&(t(),this.handleConnect()),s(l)})),void(this.firstConnect=!1);this.handleConnect()},onClose:()=>{this.dhServerSocket=null,this.socketClosingPromise=null},onError:e=>{d(e)}});l.onReadyStateChange((e=>{-1===e&&h&&h({status:o.DH_LIB_INIT}),h&&h({status:o.DH_LIB_FULL_STATUS,content:{type:"wsState",readyState:e,body:n[e]}})})),l.onMessage((e=>{const{action:t}=e;[r.TIMEOUT_EXIT,r.DISCONNECT_ALERT].includes(t)&&h&&h({status:o.DH_LIB_STATUS,content:{type:t}})})),l.open()}))};closeSocket=async()=>{this.dhServerSocket&&(this.socketClosingPromise=this.dhServerSocket.close(),await this.socketClosingPromise,this.dhServerSocket=null)};handleConnect=async()=>{if(!this.connectParams)return;const{appId:t,appKey:o,token:n,parameters:r,onConnect:c}=this.connectParams;(t||o||n)&&this.dhServerSocket?.request({action:"CONNECT",clientTs:(new Date).getTime(),requestId:e(),body:JSON.stringify({token:n,appId:t,appKey:o,...s(this.connectParams,i),parameters:{...r,...r?.extraParameters&&r?.extraParameters||{}}})}).on(((e,t)=>{c(e),0!==e.code&&t()}))};async sendMessage(e,t){try{this.dhServerSocket&&this.dhServerSocket?.request(e).on((e=>{t&&t(e)}))}catch(s){t&&t({code:-11,body:null,action:"RENDER_ERROR",requestId:e.requestId,message:JSON.stringify(s)})}}}export{c as default};
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./Client.js";export{WS_STATUS_MAP,errorTypeEnum,statusEnum}from"./interface.js";export{r as default};
|
|
1
|
+
import r from"./Client.js";export{CONNECT_MAIN_KEY,WS_STATUS_MAP,errorTypeEnum,statusEnum}from"./interface.js";export{r as default};
|
package/es/interface.d.ts
CHANGED
|
@@ -23,7 +23,20 @@ export interface ConnectParamsType {
|
|
|
23
23
|
inactiveDisconnectSec?: number;
|
|
24
24
|
preAlertSec?: number;
|
|
25
25
|
x264BitRate?: number;
|
|
26
|
+
backgroundImageUrl?: string;
|
|
27
|
+
projectId?: string;
|
|
28
|
+
characterConfigId?: string;
|
|
29
|
+
selectors?: any;
|
|
30
|
+
figureName?: string;
|
|
31
|
+
configVersion?: string;
|
|
32
|
+
extraInfo?: any;
|
|
33
|
+
roomName?: string;
|
|
34
|
+
paintSubtitleOnPicture?: boolean;
|
|
35
|
+
h5Embedded?: boolean;
|
|
36
|
+
paintWidgetOnPicture?: boolean;
|
|
37
|
+
extraParameters?: any;
|
|
26
38
|
}
|
|
39
|
+
export declare const CONNECT_MAIN_KEY: string[];
|
|
27
40
|
export interface RenderParamsType {
|
|
28
41
|
chromaEffects?: object;
|
|
29
42
|
autoChromaKey?: boolean;
|
|
@@ -83,5 +96,6 @@ export interface DhRealtimeHumanType {
|
|
|
83
96
|
connectParams: ConnectParamsType;
|
|
84
97
|
renderParams: RenderParamsType;
|
|
85
98
|
rtcConnectParams?: RtcConnectionType;
|
|
99
|
+
brtcParams?: any;
|
|
86
100
|
onDigitalHumanCallback: (data: CallbackMsgType) => void;
|
|
87
101
|
}
|
package/es/interface.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const _=["projectId","characterConfigId","configVersion","selectors","figureName"];var I,E;!function(_){_.DH_LIB_INIT="DH_LIB_INIT",_.DH_LIB_WS_SUCCESS="DH_LIB_WS_SUCCESS",_.DH_LIB_OPEN="DH_LIB_OPEN",_.DH_LIB_STATUS="DH_LIB_STATUS",_.DH_LIB_CLOSE="DH_LIB_CLOSE",_.DH_LIB_ERROR="DH_LIB_ERROR",_.DH_LIB_WARNING="DH_LIB_WARNING",_.DH_LIB_FULL_STATUS="DH_LIB_FULL_STATUS"}(I||(I={})),function(_){_.CONNECT_ERROR="CONNECT_ERROR",_.DISCONNECT_ALERT="DISCONNECT_ALERT",_.TIMEOUT_EXIT="TIMEOUT_EXIT",_.LOCAL_VIDEO_MUTED="LOCAL_VIDEO_MUTED",_.LOCAL_VIDEO_ERROR="LOCAL_VIDEO_ERROR",_.RTC_ERROR="RTC_ERROR"}(E||(E={}));const L={"-1":"UNINSTANTIATED",0:"CONNECTING",1:"OPEN",2:"CLOSING",3:"CLOSED"};export{_ as CONNECT_MAIN_KEY,L as WS_STATUS_MAP,E as errorTypeEnum,I as statusEnum};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bddh/starling-realtime-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"indexDB"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"lodash": "^4.17.21",
|
|
45
45
|
"uuid": "^9.0.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "42091abddc93acf43e0b3ac796ae6c7a185f5b43"
|
|
48
48
|
}
|
|
File without changes
|
|
File without changes
|