Stream pulling

Updated at:

To support different business scenarios, Cloud Phone provides two stream pulling modes: preemptive mode and cooperative mode. This topic describes best practices for each mode.

Streaming

Streaming refers to the process of using a client to access and interact with the screen of an Elastic Cloud Phone. To meet the needs of different business scenarios, Elastic Cloud Phone offers two streaming modes.

Streaming mode

Description

Editions

Exclusive mode

Only one client can connect to and interact with an Elastic Cloud Phone at a time. If a second client connects, the existing session is terminated and the new client takes over the stream.

  • Instance-based edition

  • Array-based edition

Collaborative mode

Up to 10 clients can connect to the same Elastic Cloud Phone to view or control its screen simultaneously. If this limit is exceeded, subsequent users cannot obtain a ticket to start a new stream. Each additional stream consumes more network bandwidth. You must monitor your bandwidth usage and control the number of client connections. This mode is typically used for scenarios that require multi-user collaboration.

  • Instance-based edition

  • Array-based edition

Pull stream mode

In both the instance and matrix editions, you can specify the stream pulling mode using the StreamMode parameter:

  • 1: preemptive mode (default).

  • 2: collaborative mode.

    Note
    • Preemptive mode is the default.

    • To make collaborative mode the default when creating a Cloud Phone matrix, submit a ticket to request whitelisting.

You can specify the pull mode when you create an instance group or matrix, or modify it for an existing one.

Specify pull mode at creation

Specify stream-pulling mode

Call CreateAndroidInstanceGroup to create an instance group, and use the StreamMode parameter to specify the stream pulling mode.

Request parameters

Parameter

Type

Required

Description

Example value

BizRegionId

string

Yes

The ID of the region. You can call the Query available regions operation to get a list of regions where Elastic Cloud Phones are available.

Valid values:

  • cn-shenzhen:

    China (Shenzhen)

  • cn-beijing:

    China (Beijing)

  • cn-shanghai:

    China (Shanghai)

  • cn-hongkong:

    China (Hong Kong)

  • ap-southeast-1:

    Asia Pacific SE 1 (Singapore)

  • cn-hangzhou:

    China (Hangzhou)

cn-hangzhou

InstanceGroupName

string

No

The name of the instance group.

Note

The name can be up to 30 characters long. It must start with a letter or a Chinese character, and cannot start with http:// or https://. The name can contain Chinese characters, letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

ECP_A

NumberOfInstances

integer

No

The number of instances in the instance group. Maximum value: 100.

1

ChargeType

string

No

The billing method.

Valid values:

  • PostPaid:

    pay-as-you-go

  • PrePaid:

    subscription

PostPaid

Period

integer

No

The subscription duration. The unit of the duration is specified by the PeriodUnit parameter.

1

PeriodUnit

string

No

The unit of the subscription duration.

Valid values:

  • Month:

    Month

  • Year:

    Year

  • Hour:

    Hour. This value is valid only for pay-as-you-go instances.

Month

InstanceGroupSpec

string

Yes

The instance group specification. You can call the DescribeSpec operation to find available specifications.

Valid values:

  • acp.perf.large:

    Performance (8 vCPU, 16 GiB memory, 32 GiB storage)

  • acp.basic.small:

    Basic (2 vCPU, 4 GiB memory, 32 GiB storage)

  • acp.std.large:

    Standard (4 vCPU, 8 GiB memory, 32 GiB storage)

acp.basic.small

AutoPay

boolean

No

Specifies whether to enable auto-payment. The default value is false.

Valid values:

  • true:

    Enables auto-payment. Make sure that your account has a sufficient balance.

  • false:

    Disables auto-payment. You need to make the payment manually.

false

AutoRenew

boolean

No

Specifies whether to enable auto-renewal. The default value is false.

Valid values:

  • true:

    The system automatically renews the subscription resource upon expiration.

  • false:

    You must manually renew the subscription resource after it expires.

false

OfficeSiteId

string

No

The network ID.

  • To create instances in a shared network, this parameter is optional. Specify the ID of a shared network on the Network page of the Elastic Cloud Phone console. If no shared network exists in the console, you can leave this parameter empty. The system automatically creates a shared network when you create the instance group.

  • To create instances in a VPC network, this parameter is required. Specify the ID of a VPC network on the Network page of the Elastic Cloud Phone console. If no VPC network exists, you must create one first.

cn-hangzhou+dir-745976****

VSwitchId

string

No

The vSwitch ID. You can call the DescribeVSwitches operation to get a list of vSwitches.

  • To create instances in a shared network, do not specify this parameter.

  • To create instances in a VPC network, this parameter is required. The instances are created in the specified vSwitch.

vsw-uf61uvzhz8ejaw776****

PolicyGroupId

string

No

The policy ID. You can call the ListPolicyGroups operation to get a list of available policies.

pg-b7bxrrwxkijjh****

ImageId

string

Yes

The image ID. You can call the DescribeImageList operation to get a list of available images.

imgc-06zyt9m93zwax****

Amount

integer

No

The number of instance groups. Default value: 1. Maximum value: 100.

8

GpuAcceleration

boolean

No

Specifies whether to enable GPU acceleration.

Valid values:

  • true:

    Enabled

  • false:

    Disabled (default)

false

KeyPairId

string

No

The ID of the key pair. If you specify a valid key pair ID when creating the instance group, the system binds the key pair to all new instances in the group during creation. You do not need to call a separate operation to bind the key pair.

Note

Key pair binding is not supported for scale-out operations.

kp-7o9xywwfutc1l****

ClientToken

string

No

A client-generated token to ensure request idempotence and prevent resubmission. The token must be no more than 100 characters long.

asadbuvwiabdbvchj****

EnableIpv6

boolean

No

Note

This parameter is not publicly available.

null

Ipv6Bandwidth

integer

No

Note

This parameter is not publicly available.

null

Tag

array<object>

No

The tags to add to the resource.

object

No

The tags to add to the resource.

Value

string

No

The tag value.

value

Key

string

No

The tag key.

key

NetworkInfo

object

No

BandwidthPackageName

string

No

CidrBlock

string

No

LimitedBandwidth

integer

No

InternetChargeType

string

No

IpRatio

integer

No

Isp

string

No

PayType

string

No

Period

integer

No

PeriodUnit

string

No

AutoPay

boolean

No

AutoRenew

boolean

No

VisibleType

string

No

PromotionId

string

No

PaidCallbackUrl

string

No

BandwidthPackageType

string

No

BandwidthPackageId

string

No

NetworkType

string

No

PromotionId

string

No

StreamMode

integer

No

PaidCallBackUrl

string

No

wya.wuying.aliyun.com/instanceGroup

SaleMode

string

No

InstanceVersion

string

No

Response parameters

Response elements

Element

Type

Description

Example

object

The response elements.

RequestId

string

The request ID.

1A923337-44D9-5CAD-9A53-95084BD4****

InstanceGroupInfos

array<object>

The instance group information.

object

InstanceGroupId

string

The instance group ID.

ag-cuv4scs4obxch****

InstanceIds

array

The list of instance IDs.

string

The instance ID.

acp-g40b9at5nhjo9****

OrderId

string

The order ID.

22365781890****

InstanceGroupIds

array

The list of instance group IDs.

string

The instance group ID.

ag-cuv4scs4obxch****

NetworkPackageOrderModel

object

The bandwidth plan order information.

BandwidthPackageOrderId

string

The bandwidth plan order ID.

25954415983*****

BandwidthPackageId

string

The ID of the Internet Shared Bandwidth.

cbwp-uf63gsv8j0ir53*****

Pull stream mode

Call CreateCloudPhoneNode to create a matrix and specify its stream pulling mode with the StreamMode parameter.

Parameters

Parameter

Type

Required

Description

Example

BizRegionId

string

Yes

The region ID.

Valid values:

  • cn-shanghai :

    China (Shanghai)

  • ap-southeast-1 :

    Singapore.

  • eu-central-1 :

    Germany (Frankfurt)

  • cn-hangzhou :

    China (Hangzhou)

cn-hangzhou

NodeName

string

No

The name of the cloud phone matrix.

node_name

ServerType

string

Yes

The specification of the cloud phone matrix.

Valid values:

  • cpm.gx7.10xlarge :

    cpm.gx7.10xlarge

  • cpm.gx8.16xlarge :

    cpm.gx8.16xlarge

cpm.gx7.10xlarge

InstanceType

string

No

The instance type.

Note

To purchase additional specifications, contact pre-sales support.

Valid values:

  • ac.max :

    The default number of instances for this specification is 25. You can adjust the number of instances by setting the PhoneCount parameter. The minimum value is 4 and the maximum value is 40.

  • ac.plus :

    The default number of instances for this specification is 40. You can adjust the number of instances by setting the PhoneCount parameter. The minimum value is 4 and the maximum value is 40.

ac.max

ChargeType

string

No

The billing method. Only the subscription billing method is supported.

Valid values:

  • PrePaid :

    Subscription.

PrePaid

PeriodUnit

string

No

The unit of the subscription period.

Valid values:

  • Month :

    Month [default]

  • Year :

    Year.

Month

Period

integer

No

The subscription period. The unit is specified by PeriodUnit.

  • If PeriodUnit is set to year, the only valid value is 1.

  • If PeriodUnit is set to month, valid values are 1, 2, 3, and 6.

1

AutoPay

boolean

No

Specifies whether to enable automatic payment.

Valid values:

  • flase :

    Manual payment in the Alibaba Cloud Billing Management console is required [default]

  • true :

    Automatic payment.

true

AutoRenew

boolean

No

Specifies whether to enable auto-renewal.

Valid values:

  • false :

    Auto-renewal is disabled. Manual renewal is required after the instance expires [default]

  • true :

    Auto-renewal is enabled. The system automatically renews the instance after the instance expires.

true

ImageId

string

No

The image ID.

imgc-075cllfeuazh0****

Count

string

No

The Quantity of the cloud phone matrix.

1

NetworkId

string

No

The ID of the office network.

cn-hangzhou+dir-5mwr9azebliva****

VSwitchId

string

No

The ID of the vSwitch.

vsw-2zeekryyc1q3sm72l****

Tag

array<object>

No

The resource tags.

object

No

The resource tags.

Key

string

No

The tag key.

keyname

Value

string

No

The tag value.

valuename

PhoneDataVolume

integer

No

The size of the independent internal storage. Unit: GiB.

10

ServerShareDataVolume

integer

No

The size of the shared internal storage. Unit: GiB.

Note

The minimum size of the shared internal storage must be greater than the number of instances in the matrix multiplied by 10 GiB.

200

ResolutionHeight

integer

No

The resolution height. Unit: pixels.

1280

ResolutionWidth

integer

No

The resolution width. Unit: pixels.

720

PhoneCount

integer

No

The number of cloud phone instances to create in a single matrix.

25

DisplayConfig

object

No

The display settings.

Dpi

integer

No

The DPI. Valid values: 72 to 600.

240

Fps

integer

No

Note

This parameter is not publicly available.

null

LockResolution

string

No

Specifies whether to lock the resolution.

Valid values:

  • off :

    Off.

  • on :

    On.

off

StreamMode

integer

No

The streaming mode for instances in the cloud phone matrix. If this parameter is not specified, the preemptive mode is used by default.

Valid values:

  • 1 :

    Preemptive mode.

  • 2 :

    Collaborative mode.

1

NetworkType

string

No

The network type of the instance.

Valid values:

  • network_pro_ecd :

    Advanced office network for cloud computers.

network_pro_ecd

NetworkInfo

object

No

The network mapping information for the instance.

BandwidthPackageName

string

No

The name of the bandwidth plan.

inst-bandwidth-pkg-1

CidrBlock

string

No

The private CIDR block.

10.10.13.0/24

LimitedBandwidth

integer

No

The peak bandwidth limit of the bandwidth plan. Unit: Mbit/s. The sum of the bandwidth used by all instances that use this bandwidth plan is subject to this upper limit.

200

InternetChargeType

string

No

The Billable methods of the bandwidth plan. Valid values:

  • PayByBandwidth (default): Pay-by-bandwidth.

  • PayBy95: Pay-by-95th-percentile. By default, IPv6 Internet bandwidth does not support the pay-by-95th-percentile billing method. To use this billing method, contact your account manager.

-

Valid values:

  • PayBy95 :

    Pay-by-95th-percentile.

  • PayByBandwidth :

    Pay-by-bandwidth.

PayByBandwidth

IpRatio

integer

No

The ratio of IP addresses to instances.

Valid values:

  • 128 :

    128 cloud phone instances correspond to one EIP (Internet egress IP address)

128

Isp

string

No

The line type.

Valid values:

  • ChinaUnicom :

    China Unicom.

  • ChinaMobile :

    China Mobile.

  • ChinaTelecom :

    China Telecom.

  • BGP :

    BGP (multi-ISP) line.

ChinaTelecom

PayType

string

No

The billing method.

Valid values:

  • PostPaid :

    Pay-as-you-go.

  • PrePaid :

    Subscription.

PostPaid

VisibleType

string

No

The visibility scope.

CPS

PaidCallbackUrl

string

No

The redirect URL of the payment success page.

https://aim.wuying.aliyun.com/nodes

BandwidthPackageType

string

No

The bandwidth type.

Valid values:

  • cbwp_ecd :

    Premium bandwidth plan.

cbwp_ecd

BandwidthPackageId

string

No

The ID of the Internet Shared Bandwidth instance.

cbwp-uf6g3hgg*******8s3lxiob3

UpBandwidthLimit

integer

No

The upstream bandwidth throttling. Unit: Mbit/s.

50

DownBandwidthLimit

integer

No

The downstream bandwidth throttling. Unit: Mbit/s.

50

UseTemplate

string

No

Specifies whether to use a template during creation. To use a random template from the template list, set the value to Random. To use a specific template, specify the template ID.

Random

PromotionId

string

No

The promotion ID.

50003308011****

PaidCallBackUrl

string

No

The redirect URL of the payment success page.

wya.wuying.aliyun.com/instanceGroup

SwapSize

integer

No

The size of the swap space.

0

IsSingleImgDisk

boolean

No

Specifies whether to use a single image disk. Default value: false. A value of false indicates that the system disk and the shared internal storage image disk are used.

ChannelCookie

string

No

The channel cookie that is passed through to the sales system when an order is placed.

channel-cookie-node

Response parameters

Element

Type

Description

Example

object

The request information.

RequestId

string

The request ID.

69BCBBE4-FCF2-59B8-AD9D-531EB422****

OrderId

string

The order ID.

223684716098****

NodeInfos

array<object>

The cloud phone matrix information.

object

The cloud phone matrix information.

NodeId

string

The cloud phone matrix ID.

cpn-e5kxgjyt8s1mb****

InstanceIds

array

The list of cloud phone instance IDs.

string

The cloud phone instance ID.

cpn-e5kxgjyt8s1mb****

NetworkPackageOrderModel

object

The bandwidth plan order information.

BandwidthPackageOrderId

string

The bandwidth plan order ID.

25954415983*****

BandwidthPackageId

string

The ID of the Internet Shared Bandwidth.

cbwp-uf63gsv8j0ir53*****

Modify an existing streaming mode

Note

This is an asynchronous API. The change may take a few seconds to take effect. Wait at least 10 seconds before you verify the modification.

Important

If you call this API to modify the streaming mode during an active stream, the current stream will be disconnected and the client will receive error code 2027. To ensure service stability, modify the streaming mode only when necessary and avoid frequent changes. For more information about error codes, see Client-side error codes.

Instance group

For an existing instance group, you can call Modify instance group information to modify the StreamMode parameter. This parameter specifies the streaming mode for all cloud phone instances in the instance group.

Request parameters

Request parameters

Parameter

Type

Required

Description

Example

InstanceGroupId

string

No

The ID of the instance group.

ag-cuv4scs4obxhs****

NewInstanceGroupName

string

No

The new name of the instance group.

Note

The name can be up to 30 characters in length. It can contain letters, digits, colons (:), underscores (_), periods (.), or hyphens (-). It must start with letters but cannot start with http:// or https://.

newName

PolicyGroupId

string

No

The ID of the policy.

pg-2w97kp89gnsif****

StreamMode

integer

No

The streaming mode for instances in the instance group. Defaults to 1 (Preemptive).

Valid values:

  • 1 :

    Preemptive Mode (Default)

  • 2 :

    Collaborative Mode

1

Response parameters

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The ID of the request.

6C83EBE3-F267-5F11-ABF8-4E7B90B****

Cloud phone node

For an existing cloud phone node, you can call ModifyCloudPhoneNode to modify the StreamMode parameter. This parameter specifies the streaming mode for all cloud phone instances in the node.

Request parameters

Parameter

Type

Required

Description

Example

NodeId

string

No

The ID of the cloud phone matrix.

cpn-0ugbptfu473fy****

NewNodeName

string

No

The name that you want to assign to the cloud phone matrix.

node_name_new

StreamMode

integer

No

Specifies the streaming mode for instances in the cloud phone matrix. If this parameter is left empty, the exclusive mode is used.

Valid values:

  • 1 :

    Exclusive mode

  • 2 :

    Collaborative mode

1

Response parameters

Response parameters

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The request ID.

7B9EFA4F-4305-5968-BAEE-BD8B8DE5****

Obtain a streaming ticket

Call the BatchGetAcpConnectionTicket operation to obtain a streaming ticket. The behavior and limitations of this API operation vary based on the streaming mode:

  • preemptive mode:

    • Only one user can connect at a time. If multiple users request a ticket, subsequent requests return an error.

    • The same user can request a ticket multiple times, but only the most recent ticket takes effect.

    • When preemption is allowed, requesting a ticket does not disconnect the currently connected user. The preemption occurs only when a new user attempts to connect to the instance.

  • collaboration mode: You can obtain tickets for different users to stream simultaneously by passing different EnduserId values. Each call can include only one EnduserId.

    Note

    The theoretical limit is 10 users. The console and card mode use two user slots. In production, we recommend no more than five users in a collaboration session.

Request parameters

Parameter

Type

Required

Description

Example

InstanceGroupId

string

No

The instance group ID.

ag-25nt4kk9whjh****

InstanceIds

array

No

The list of Cloud Phone instance IDs. You can specify 1 to 100 IDs.

string

No

The instance ID.

acp-bj9t2gmys****

EndUserId

string

No

The ID of the assigned user. If you do not specify this parameter, the system user assigned in the background is used to obtain the ticket.

The usage of this parameter varies based on the Cloud Phone edition and the instance streaming mode:

  • Cloud Phone Instance Edition or Cloud Phone Matrix Edition (preemptive mode): You can obtain a Ticket only by using the same EnduserId.

  • Cloud Phone Matrix Edition (collaborative mode): You can pass different EnduserId values to obtain Ticket values and stream for different users (up to 5) at the same time. You can pass only one EnduserId at a time.

Note

You can define the instance streaming mode by using the StreamMode parameter of the ModifyCloudPhoneNode operation.

user

ConnectionMode

string

No

The connection mode.

custom

InstanceTasks

array<object>

No

The instance connection tasks. This parameter is used to query whether the ticket retrieval task is completed.

object

No

The instance connection task.

InstanceId

string

No

The instance ID.

acp-fkuit0cmyfvzz****

TaskId

string

No

The task ID.

cn-hangzhou@c9f5c2e8-f5c4-4b01-8602-000cae94****

Ports

array

No

The list of custom connection ports.

string

No

The custom connection port.

10000

Response parameters

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

7B9EFA4F-4305-5968-BAEE-BD8B8DE5****

InstanceConnectionModels

array<object>

The instance connection task results.

object

The instance connection task results.

AppInstanceGroupId

string

The delivery group ID.

aig-1uzb6heg797z3****

InstanceId

string

The instance ID.

acp-ajxvwo1u0hqvd****

TaskStatus

string

The task status. A value of FINISHED indicates that you can obtain the ticket from the Ticket field. Otherwise, you must use the TaskId to call this operation and query the ticket generation result.

FINISHED

TaskId

string

The task ID.

cn-hangzhou@c9f5c2e8-f5c4-4b01-8602-000cae94****

Ticket

string

The ticket used to connect to the user instance.

piVE58_AdmVSVW7SEW3*AE5*p8mmO5gvItsNOmv4S_f_cNpoU_BOTwChTBoNM1ZJeedfK9zxYnbN5hossqIZCr6t7SGxRigm2Cb4fGaCdBZWIzmgdHq6sXXZQg4KFWufyvpeV*0*Cm58slMT1tJw3****

ErrorCode

string

The error cause.

InvalidResourceId.NotFound

PersistentAppInstanceId

string

The persistent session ID.

p-abdywvcksdb****

AppInstanceId

string

The physical instance ID.

ai-0caoetkqi8kj****

Port

integer

The connection port.

10000

Note

A ticket is valid for 10 minutes.

Disconnect user connection

Use DisconnectAndroidInstance to disconnect a user connection. The behavior of this operation depends on the pull mode:

  • Preemptive mode: Disconnects the user who is currently streaming.

  • Collaborative mode: Disconnects the user who is currently streaming and invalidates the corresponding ticket.

Request parameters

Parameter

Type

Required

Description

Example

InstanceIds

array

No

A list of instance IDs. You can specify 1 to 100 IDs.

string

No

An instance ID.

acp-5hh4a31emkt6u****

EndUserId

string

No

If you use the Cloud Phone Matrix Edition and the instance stream pattern is collaborative mode, you can specify EndUserId to disconnect a specific user and invalidate the corresponding ticket.

user1

Response parameters

Element

Type

Description

Example

object

The response body.

RequestId

string

The request ID.

E5138F7E-46B5-526A-8C99-82DEAE6B****

Client-side error codes

The following table lists the disconnection errors returned by onDisconnected.

Error code

Description

2002

The current cloud phone is preempted.

2004

The current user is disconnected.

2027

The stream pulling mode changed.

25

The ticket verification failed.

Note

This error also occurs if you try to reconnect with the same ticket after the user is disconnected.