CloudGamingGroupControlWebSDK

云渲染 CloudGamingGroupControlWebSDK(TCGGCSDK),用于云渲染 PaaS 应用的开发。该SDK extends from TCGSDK,上层封装了 Group Control 相关方法,底层接口也同时适用,可参考 CloudGamingWebSDK 。

Constructor

new CloudGamingGroupControlWebSDK()

Methods

init(config) → {void}

Parameters:
Name Type Description
config GCInitConfig

初始化配置

Returns:
Type
void

start(serverSession) → {void}

启动云渲染

Example
TCGGCSDK.start(serverSession);
Parameters:
Name Type Description
serverSession string

调用对应的云API 获取的 ServerSession

Returns:
Type
void

setMaster(params) → {void}

设置 master

Example
TCGGCSDK.setMaster({instanceId: 'cai-xxx1'});
Parameters:
Name Type Description
params Object
Properties
Name Type Description
instanceId string

master的 instanceId

Returns:
Type
void

startSync(params) → {void}

Default Value:
  • 全量同步

开始同步,根据设置的 instanceIds 进行同步

Example
TCGGCSDK.startSync({instanceIds: ['cai-xxx1', 'cai-xxx2']});
Parameters:
Name Type Description
params Object
Properties
Name Type Description
instanceIds Array

string[] 需要同步的设备列表

Returns:
Type
void

stopSync() → {void}

停止同步(全量)

Returns:
Type
void

setLocation(params) → {Promise.<BatchTaskResponse>}

设置设备 GPS 信息

Example
TCGGCSDK.setLocation({'cai-xxx1': {Longitude: 113.32412, Latitude: 23.124124}, 'cai-xxx2': {Longitude: 114.32412, Latitude: 24.124124}})
Parameters:
Name Type Description
params Object

key 为 instanceId

Properties
Name Type Description
key string

设备 instanceId

value Object
Properties
Name Type Description
Longitude number
Latitude number
Returns:
Type
Promise.<BatchTaskResponse>

setResolution(params) → {Promise.<BatchTaskResponse>}

设置设备 Resolution

Example
TCGGCSDK.setResolution({'cai-xxx1': {Width: 720, Height: 1080}, {'cai-xxx2': {Width: 720, Height: 1080}})
Parameters:
Name Type Description
params Object

key 为 instanceId

Properties
Name Type Description
key string

设备 instanceId

value Object
Properties
Name Type Description
Width number
Height number
DPI number
Returns:
Type
Promise.<BatchTaskResponse>

paste(params) → {Promise.<BatchTaskResponse>}

往设备粘贴文本

Example
TCGGCSDK.paste({'cai-xxx1': {Text: 'abc'}, {'cai-xxx2': {Text: '123'}})
Parameters:
Name Type Description
params Object

key 为 instanceId

Properties
Name Type Description
key string

设备 instanceId

value Object
Properties
Name Type Description
Text string

要粘贴的文本

Returns:
Type
Promise.<BatchTaskResponse>

sendClipboard(params) → {Promise.<BatchTaskResponse>}

发送文本到剪切板

Example
TCGGCSDK.sendClipboard({'cai-xxx1': {Text: 'abc'}, {'cai-xxx2': {Text: '123'}})
Parameters:
Name Type Description
params Object

key 为 instanceId

Properties
Name Type Description
key string

设备 instanceId

value Object
Properties
Name Type Description
Text string

要发送的内容

Returns:
Type
Promise.<BatchTaskResponse>

shake(params) → {Promise.<BatchTaskResponse>}

摇一摇

Example
TCGGCSDK.shake({'cai-xxx1': {}, {'cai-xxx2': {}})
Parameters:
Name Type Description
params Object

key 为 instanceId

Properties
Name Type Description
key string

设备 instanceId

value Object

value 暂时传空对象 {}

Returns:
Type
Promise.<BatchTaskResponse>

setSensor(params) → {Promise.<BatchTaskResponse>}

设置设备传感器信息

Example
TCGGCSDK.setSensor({'cai-xxx1': {Type: 'accelerometer', Values: [10, 10, 10]},  {'cai-xxx2': {Type: 'gyroscope', Values: [10, 10, 10]}})
Parameters:
Name Type Description
params Object

key 为 instanceId

Properties
Name Type Description
key string

设备 instanceId

value Object
Properties
Name Type Description
Type 'accelerometer' | 'gyroscope'

传感器leasing accelerometer(加速器),gyroscope(陀螺仪)

Values Array.<string>

传感器对应的值,数组长度为 3,分辨表示 x/y/z 轴的值

Returns:
Type
Promise.<BatchTaskResponse>

setImageEvent(params) → {void}

设置截图事件

Example
TCGGCSDK.setImageEvent({interval: 10, quality: 50});
Parameters:
Name Type Description
params Object
Properties
Name Type Description
interval number

截图事件的间隔,单位毫秒

quality number

截图质量,取值范围 0-100

Returns:
Type
void

getInstanceImage(params) → {void}

获取实例截图信息

Example
TCGGCSDK.getInstanceImage({instanceId: 'cai-xxx1'});
Parameters:
Name Type Description
params Object
Properties
Name Type Description
instanceId string
Returns:
Type
void