|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd"> |
| 3 | +<reference id="api_createdatastreamex1"> |
| 4 | + <title><ph keyref="createDataStreamEx1"/></title> |
| 5 | + <shortdesc id="short"><ph id="shortdesc">创建数据流。</ph></shortdesc> |
| 6 | + <prolog> |
| 7 | + <metadata> |
| 8 | + <keywords> |
| 9 | + <indexterm keyref="createDataStreamEx1" /> |
| 10 | + </keywords> |
| 11 | + </metadata> |
| 12 | + </prolog> |
| 13 | + <refbody><section id="prototype"> |
| 14 | + <p outputclass="codeblock"> |
| 15 | + <codeblock props="android" outputclass="language-java"/> |
| 16 | + <codeblock props="ios mac" outputclass="language-objectivec"/> |
| 17 | + <codeblock props="windows" outputclass="language-cpp">virtual int createDataStream(int* streamId, bool reliable, bool ordered, conn_id_t connectionId = agora::rtc::DEFAULT_CONNECTION_ID) = 0; |
| 18 | +</codeblock> |
| 19 | + <codeblock props="electron" outputclass="language-typescript"/> |
| 20 | + <codeblock props="unity" outputclass="language-csharp"/> |
| 21 | + <codeblock props="rn" outputclass="language-typescript"/> |
| 22 | + <codeblock props="flutter" outputclass="language-dart"/> |
| 23 | + </p> |
| 24 | + |
| 25 | + </section> |
| 26 | + <section id="detailed_desc"> |
| 27 | + <dl outputclass="deprecated" id="dl_fvq_yqm_3qb"> |
| 28 | + <dlentry> |
| 29 | + <dt>弃用:</dt> |
| 30 | + <dd>该方法已废弃。请改用 <xref keyref="createDataStreamEx2"/>。</dd> |
| 31 | + </dlentry> |
| 32 | + </dl> |
| 33 | + <p id="desc">你可以调用该方法创建数据流并提高数据传输的可靠性和有序性。</p> |
| 34 | + <note type="attention" id="note"> |
| 35 | + <ul id="ul_gvq_yqm_3qb"> |
| 36 | + <li>请确保将 <codeph>reliable</codeph> 和 <codeph>ordered</codeph> 设为相同的值。</li> |
| 37 | + <li>在 <xref keyref="IRtcEngine"/> 生命周期内,每个用户最多只能创建 5 个数据流。</li> |
| 38 | + <li>频道内数据通道最多允许数据延迟 5 秒,若超过 5 秒接收方尚未收到数据流,则数据通道会向 app 报错。</li> |
| 39 | + </ul> |
| 40 | + </note> |
| 41 | + </section> |
| 42 | + <section id="parameters"> |
| 43 | + <title>参数</title> |
| 44 | + <parml id="parml_cwc_jsm_3qb"> |
| 45 | + <plentry props="windows" id="streamId"> |
| 46 | + <pt>streamId</pt> |
| 47 | + <pd>输出参数,数据流 ID。</pd> |
| 48 | + </plentry> |
| 49 | + <plentry> |
| 50 | + <pt>reliable</pt> |
| 51 | + <pd> |
| 52 | + <p>是否保证数据可靠性,即接收方是否需要在数据发送后的 5 秒内接收:<ul id="ul_dwc_jsm_3qb"> |
| 53 | + <li><codeph>true</codeph>: 保证接收方会在数据发送后的 5 秒内接收。如果接收方在数据发送后的 5 |
| 54 | + 秒内没有接收数据,SDK 会报错。</li> |
| 55 | + <li><codeph>false</codeph>: 不保证收方会在数据发送后的 5 秒内接收。如果接收延迟或丢失数据,SDK |
| 56 | + 不会报错。</li> |
| 57 | + </ul></p> |
| 58 | + </pd> |
| 59 | + </plentry><plentry id="ordered"> |
| 60 | + <pt>ordered</pt> |
| 61 | + <pd> |
| 62 | + <p>是否保证数据有序性,即接收方是否需要收到有序的数据:<ul id="ul_gwc_jsm_3qb"> |
| 63 | + <li><codeph><ph keyref="true"/></codeph>: |
| 64 | + 保证接收方会按照发送方发送的顺序收到数据包。</li> |
| 65 | + <li><codeph><ph keyref="false"/></codeph>: |
| 66 | + 不保证接收方按照发送方发送的顺序收到数据包。</li> |
| 67 | + </ul></p> |
| 68 | + </pd> |
| 69 | + </plentry> |
| 70 | + <plentry> |
| 71 | + <pt>connectionId</pt> |
| 72 | + <pd> |
| 73 | + <p>连接 ID。</p> |
| 74 | + </pd> |
| 75 | + </plentry> |
| 76 | + </parml> |
| 77 | + </section> |
| 78 | + <section id="return_values"> |
| 79 | + <title>返回值</title> |
| 80 | + <ul> |
| 81 | + <li props="android ios mac electron">成功创建的数据流 ID:方法调用成功。</li> |
| 82 | + <li props="windows">0: 创建数据流成功。</li> |
| 83 | + <li>< 0: 创建数据流失败。</li> |
| 84 | + </ul> |
| 85 | + </section></refbody> |
| 86 | +</reference> |
0 commit comments