createDataStream [1/2]
Creates a data stream.
public abstract int createDataStream(boolean reliable, boolean ordered);
You can call this method to create a data stream and improve the reliability and ordering of data transmission.
Call timing
You can call this method either before or after joining a channel.
Restrictions
Each user can create up to five data streams during the lifecycle of RtcEngine. The data stream will be destroyed when leaving the channel, and the data stream needs to be recreated if needed.
Parameters
- reliable
-
Sets whether the recipients are guaranteed to receive the data stream within five seconds:
true
: The recipients receive the data from the sender within five seconds. If the recipient does not receive the data within five seconds, the SDK triggers the onStreamMessageError callback and returns an error code.false
: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream.
Attention: Please ensure that reliable and ordered are either both set totrue
or both set tofalse
. - ordered
-
Sets whether the recipients receive the data stream in the sent order:
true
: The recipients receive the data in the sent order.false
: The recipients do not receive the data in the sent order.
Returns
- ID of the created data stream, if the method call succeeds.
- < 0: Failure.