Skip to content

Commit 39e04b0

Browse files
author
ranpeng
committed
refactor: 增加 init 参数配置 paste 功能
1 parent 40ff407 commit 39e04b0

File tree

2 files changed

+43
-21
lines changed

2 files changed

+43
-21
lines changed

dist/tcg-sdk/index.d.ts

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,18 @@ type RawEventData = {
438438
key?: number;
439439
};
440440

441+
/**
442+
* 麦克风参数,可根据需求设置具体值
443+
* @ignore
444+
*/
441445
export interface MicProfileConstraints extends MediaTrackConstraints {
442446
sampleRate?: number; // 默认值 44100
443447
echoCancellation?: ConstrainBoolean; // 回声消除 默认值 true
444448
noiseSuppression?: ConstrainBoolean; // 降噪 默认值 true
445449
autoGainControl?: ConstrainBoolean; // 增益 默认值 true
446450
deviceId?: string; // input 的设备id,可以通过 getDevices 接口获取, 默认采用系统自选设备
447451
}
452+
448453
/**
449454
* 摄像头参数,可根据需求设置具体值
450455
* @ignore
@@ -477,93 +482,93 @@ export interface InitConfig {
477482
/**
478483
* 是否开启本地麦克风
479484
*
480-
* 默认值为 false
485+
* @default false
481486
*/
482487
mic?: boolean | MicProfileConstraints;
483488
/**
484489
* 是否开启本地摄像头
485490
*
486-
* 默认值为 false
491+
* @default false
487492
*/
488493
camera?: boolean | CameraProfileConstraints | CameraProfileType;
489494
/**
490495
* true 为使用平板滑动鼠标模式,false 为绝对映射模式。该参数只针对移动端,PC 端忽略该参数。该 mode 下鼠标产生相对位移。
491496
*
492-
* 默认值:false
497+
* @default false
493498
*/
494499
tabletMode?: boolean;
495500
/**
496501
* true 为使用接入手游,false 为适用端游
497502
*
498-
* 默认 false
503+
* @default false
499504
*/
500505
mobileGame?: boolean;
501506
/**
502507
* 手游启用VPX 编码
503508
*
504-
* 默认 false
509+
* @default false
505510
*/
506511
mobileVpx?: boolean;
507512
/**
508513
* 鼠标模式: 0 本地鼠标图片,1 云端下发鼠标图片,2 云端渲染
509514
*
510-
* 默认 0
515+
* @default 0
511516
*/
512517
cursorMode?: number;
513518
/**
514519
* 是否启动点击全屏操作,true 为启用,false为禁用。
515520
*
516-
* 默认值为 false
521+
* @default false
517522
*/
518523
clickToFullscreen?: boolean;
519524
/**
520525
* 点击body 任意地方尝试播放video,true 为启用,false为禁用。
521526
*
522-
* 默认值为 true
527+
* @default true
523528
*/
524529
clickBodyToPlay?: boolean;
525530
/**
526531
* 用户操作空闲时间阈值,单位为秒,默认值:300s 空闲超过这个时间将触发 onNetworkChange 事件,消息为 {status: 'idle', times: 1}
527532
*
528-
* 默认值:300s
533+
* @default 300
529534
*/
530535
idleThreshold?: number;
531536
/**
532537
* 断开的时候是否保留最后一帧画面,如果需要保留最后一帧画面并重连,不能再次调用 init 函数,而是先调用 destroy() 接口,再调用 start() 接口。
533538
*
534539
* mac safari/ios webview 无法生效
535540
*
536-
* 默认值:false
541+
* @default false
537542
*/
538543
keepLastFrame?: boolean;
539544
/**
540545
* 是否自动重连,会在弱网,或帧率持续掉 0所导致的断连时,主动重连
541546
*
542-
* 默认值:true
547+
* @default true
543548
*/
544549
reconnect?: boolean;
545550
/**
546551
* 是否显示加载中画面
547552
*
548-
* 默认值: true
553+
* @default true
549554
*/
550555
showLoading?: boolean;
551556
/**
552557
* 加载中的文字提示内容
553558
*
554-
* 默认值:'正在启动云渲染'
559+
* @default '正在启动云渲染'
555560
*/
556561
loadingText?: string;
557562
/**
558563
* 当横竖屏切换时,是否自动旋转html节点适配,**该参数会旋转整个html**
559564
*
560-
* 默认值:false
565+
* @default false
561566
*/
562567
autoRotateContainer?: boolean;
563568
/**
564569
* 当横竖屏切换时,是否自动旋转挂载节点(mount)适配,**该参数会旋转挂载节点(mount)**
565570
*
566-
* 默认值:false
571+
* @default false
567572
*/
568573
autoRotateMountPoint?: boolean;
569574
/**
@@ -573,7 +578,7 @@ export interface InitConfig {
573578
*
574579
* false 不拉伸video,保持原有云端分辨率
575580
*
576-
* 默认值 true
581+
* @default true
577582
*/
578583
fullVideoToScreen?: boolean;
579584
/**
@@ -583,13 +588,13 @@ export interface InitConfig {
583588
/**
584589
* 0:关闭鼠标高频采样, 1:打开,但是打包发送, 2:拆开发送, 3: 限制包长度,多的丢掉
585590
*
586-
* 默认值 0
591+
* @default 0
587592
*/
588593
webDraftLevel?: number;
589594
/**
590595
* 强制显示鼠标
591596
*
592-
* 默认值 false
597+
* @default false
593598
*/
594599
forceShowCursor?: boolean;
595600
/**
@@ -602,8 +607,18 @@ export interface InitConfig {
602607
defaultCursorImgUrl?: string;
603608
/**
604609
* 云上应用交互模式,支持鼠标 或者 触摸
610+
*
611+
* @default 'cursor'
605612
*/
606613
clientInteractMode?: 'cursor' | 'touch';
614+
/**
615+
* 劫持键盘 Ctrl+v/Cmd+v,当用户使用粘贴功能时候,直接将本地剪切板内容发送给云端
616+
*
617+
* **通常在云端 input 框 focus 时候使用**
618+
*
619+
* @default false
620+
*/
621+
enablePaste?: boolean;
607622
/**
608623
* 初始化完毕的回调,触发此回调之后才能调用后面的 API
609624
*
@@ -934,9 +949,10 @@ export interface InitConfig {
934949
}
935950

936951
/**
937-
* 云渲染JSSDK(TCGSDK),用于云渲染 PaaS 应用的开发。TCGSDK export 为单例子,并采用配置,注册回调方式,并提供了包括鼠标键盘控制,音视频控制,游戏进程控制相关接口,接口详情请参考下列说明。
952+
* 云渲染JSSDK(TCGSDK),用于云渲染 PaaS 应用的开发。TCGSDK export 为单例,并采用配置,注册回调方式,并提供了包括鼠标键盘控制,音视频控制,游戏进程控制相关接口,接口详情请参考下列说明。
953+
* @hideconstructor
938954
*/
939-
class TCGSDK {
955+
export class TCGSDK {
940956
// -------------- 云渲染生命周期相关接口 ------------
941957
/**
942958
* @param {InitConfig} config
@@ -1301,6 +1317,12 @@ class TCGSDK {
13011317
*
13021318
*/
13031319
setKMStatus({ keyboard, mouse }: { keyboard: boolean; mouse: boolean }): { code: number };
1320+
/**
1321+
* 设置是否劫持 Ctrl+v/Cmd+v,当用户使用粘贴功能时候,直接将本地剪切板内容发送给云端
1322+
*
1323+
* **通常在云端 input 框 focus 时候使用**
1324+
*/
1325+
setPaste(enable: boolean): void;
13041326
// -------------- 音视频控制相关接口 ------------
13051327
/**
13061328
* 设置码流参数,该接口为设置建议码流参数,云端可能会根据游戏动态调整

dist/tcg-sdk/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)