@@ -19,6 +19,7 @@ export interface OnInitSuccessResponse {
1919 * @ignore
2020 */
2121export interface OnConnectFailedResponse extends BaseResponse { }
22+
2223export interface OnConnectSuccessResponse {
2324 readonly code : number ;
2425 readonly seat_index : number ; // 座位号,多人云游场景可能会用到
@@ -427,14 +428,19 @@ export type OnEventLatencyResponse = {
427428 } ;
428429} ;
429430
431+ export type OnEventPointerLockErrorResponse = {
432+ type : 'pointerlockerror' ;
433+ } ;
434+
430435export type OnEventResponse =
431436 | OnEventAutoplayResponse
432437 | OnEventIdleResponse
433438 | OnEventOpenUrlResponse
434439 | OnEventWebrtcStatsResponse
435440 | OnEventNoflowResponse
436441 | OnEventNoflowcenterResponse
437- | OnEventLatencyResponse ;
442+ | OnEventLatencyResponse
443+ | OnEventPointerLockErrorResponse ;
438444
439445/**
440446 * 直播推流相关
@@ -959,8 +965,8 @@ export interface InitConfig {
959965 *
960966 * @function
961967 * @param {Object } response - onCursorShowStatChange 回调函数的 response
962- * @param {boolean } response.oldStatus - 是否显示
963- * @param {boolean } response.newStatus - 手柄索引
968+ * @param {boolean } response.oldStatus - 老状态
969+ * @param {boolean } response.newStatus - 新状态
964970 */
965971 onCursorShowStatChange ?: ( response : OnCursorShowStatChangeResponse ) => void ;
966972 /**
@@ -1029,8 +1035,8 @@ export interface InitConfig {
10291035 * 目前主要用于自动播放是否成功回调
10301036 *
10311037 * @function
1032- * @param {Object } response - onConfigurationChange 回调函数的 response
1033- * @param {string } response.type - 对应类型 'idle' | 'noflow' | 'noflowcenter' | 'stats' | 'openurl' | 'latency'
1038+ * @param {Object } response - onEvent 回调函数的 response
1039+ * @param {string } response.type - 对应类型 'autoplay' | ' idle' | 'noflow' | 'noflowcenter' | 'stats' | 'openurl' | 'latency' | 'pointerlockerror '
10341040 * @param {any } response.data - 根据对应 code 判断
10351041 */
10361042 onEvent ?: ( response : OnEventResponse ) => void ;
@@ -1238,10 +1244,11 @@ export class TCGSDK {
12381244 /**
12391245 * **聚焦输入框时**快速发送内容
12401246 * @param {string } content 需要发送的内容
1247+ * @param {Function } [callback] 回调 code: 0 success, 1 failed
12411248 * @example
12421249 * TCGSDK.sendText('abc');
12431250 */
1244- sendText ( content : string ) : void ;
1251+ sendText ( content : string , callback ?: Function ) : void ;
12451252 /**
12461253 * 设置云端应用交互模式,也可通过 *InitConfig clientInteractMode* 设置
12471254 * @param { string } mode='cursor' -'cursor' 表示鼠标,‘touch’ 表示触控,**需要云上应用支持**
@@ -1291,7 +1298,7 @@ export class TCGSDK {
12911298 * @returns 返回 Promise 对象。
12921299 * | Name | Type | Description |
12931300 * | ------------- | ------------------- | --------------------------- |
1294- * | code | number | 0 success, 1 ack dataChannel 未创建成功,请重试, 2 该数据通道已经存在 |
1301+ * | code | number | 0 success, 1 ack dataChannel 未创建成功,请重试, 2 该数据通道已经存在, -1 创建失败(ack 返回) |
12951302 * | msg | string | dataChannel收到消息的回调函数 |
12961303 * | sendMessage | (message: string \| Blob \| ArrayBuffer \| ArrayBufferView) => void; | 用于发送消息的方法,会透传数据给 peerConnection 的 dataChannel,参数message 支持 RTCDataChannel send 所有数据类型 |
12971304 *
@@ -1494,12 +1501,15 @@ export class TCGSDK {
14941501 getVideoVolume ( ) : number ;
14951502 /**
14961503 * 播放视频
1504+ *
1505+ * * 'play' 其实是调用了 video 的 play, 返回 Promise*
1506+ *
14971507 * @param {('play'|'pause') } status
14981508 *
14991509 * @example
15001510 * TCGSDK.playVideo('play');
15011511 */
1502- playVideo ( status : 'play' | 'pause' ) : void ;
1512+ playVideo ( status : 'play' | 'pause' ) : void | Promise < void > ;
15031513 /**
15041514 * 播放音频
15051515 * @param {('play'|'pause') } status
@@ -1508,6 +1518,13 @@ export class TCGSDK {
15081518 * TCGSDK.playAudio('play');
15091519 */
15101520 playAudio ( status : 'play' | 'pause' ) : void ;
1521+ /**
1522+ * 获取 video 对象
1523+ *
1524+ * @example
1525+ * TCGSDK.getVideoElement();
1526+ */
1527+ getVideoElement ( ) : HTMLVideoElement ;
15111528 /**
15121529 * 获取用户开启的摄像头或麦克风 stream
15131530 */
@@ -1545,7 +1562,7 @@ export class TCGSDK {
15451562 * @example
15461563 * TCGSDK.setMicProfile({sampleRate: 44100, echoCancellation: true, noiseSuppression: true, autoGainControl: true});
15471564 */
1548- setMicProfile ( profile : MicProfileConstraints ) : void ;
1565+ setMicProfile ( profile : MicProfileConstraints ) : Promise < void > ;
15491566 /**
15501567 * @async
15511568 *
@@ -1572,13 +1589,15 @@ export class TCGSDK {
15721589 /**
15731590 * 获取所有设备
15741591 *
1592+ * @async
1593+ *
15751594 * @returns {MediaDeviceInfo[] }
15761595 */
15771596 getDevices ( ) : Promise < MediaDeviceInfo [ ] > ;
15781597 /**
15791598 * 设置video 的旋转角度。
15801599 *
1581- * - 发现有时候客户会自己旋转屏幕,其实不建议。因为涉及到的坐标转换很复杂,SDK 内部已经处理。连同插件的旋转和数据处理都在SDK 内部做了。建议用该方法,或者直接在 Init 参数重配置自动旋转-
1600+ * * 发现有时候客户会自己旋转屏幕,其实不建议。因为涉及到的坐标转换很复杂,SDK 内部已经处理。连同插件的旋转和数据处理都在SDK 内部做了。建议用该方法,或者直接在 Init 参数重配置自动旋转*
15821601 *
15831602 * @param {Object } param
15841603 * @param {(0|90|270) } param.deg=0 - 旋转角度当前只支持 0/90,手游 0/270
@@ -1624,7 +1643,6 @@ export class TCGSDK {
16241643 * @param {boolean } [param.showOnAckMessage] - 打印ACK回包消息
16251644 * @param {boolean } [param.showOnCdMessage] - 打印CD回包消息
16261645 * @param {boolean } [param.showOnSvMessage] - 打印Sv回包消息
1627- * @param {boolean } [param.userid] - 用户id
16281646 *
16291647 * @example
16301648 * TCGSDK.setDebugMode({showLog: true, showStats: true});
0 commit comments