-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathapi_player_openwithurl.dita
More file actions
70 lines (70 loc) · 4.38 KB
/
Copy pathapi_player_openwithurl.dita
File metadata and controls
70 lines (70 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
<reference id="api_player_openwithurl">
<title><ph keyref="OpenWithUrl"/></title>
<shortdesc id="short"><ph id="shortdesc">打开 URL 资源。</ph></shortdesc>
<prolog>
<metadata>
<keywords>
<indexterm keyref="OpenWithUrl"/>
</keywords>
</metadata>
</prolog>
<refbody>
<section id="prototype">
<p outputclass="codeblock">
<codeblock props="android" outputclass="language-java">public void openWithUrl(String url, long startTime, AsyncCallback callback);</codeblock>
<codeblock props="hmos" outputclass="language-arkts"/>
<codeblock props="ios mac" outputclass="language-objectivec">- (void)openWithUrl:(NSString * _Nonnull)url startTime:(uint64_t)startTime cb:(void (^_Nullable)(AgoraRteError* _Nullable err))cb;</codeblock>
<codeblock props="cpp unreal" outputclass="language-cpp">void OpenWithUrl(const char* url, uint64_t start_time, std::function<void(rte::Error* err)> cb);</codeblock>
<codeblock props="bp" outputclass="language-cpp"/>
<codeblock props="electron" outputclass="language-typescript"/>
<codeblock props="unity cs" outputclass="language-csharp"/>
<codeblock props="rn" outputclass="language-typescript"/>
<codeblock props="flutter" outputclass="language-dart"/> </p>
</section>
<section id="detailed_desc" deliveryTarget="details" otherprops="no-title">
<dl outputclass="since">
<dlentry props="native">
<dt>自从</dt>
<dd>v4.5.0</dd>
</dlentry>
</dl>
<p>该方法支持通过 URL 打开实时流媒体。如果你想要加快打开 URL 资源的速度,可以在调用该方法前,调用 <xref keyref="PreloadWithUrl"/> 预加载资源。</p>
<p>如果资源打开失败,你会收到 <xref keyref="onStateChanged"/> 的回调报告状态为 <ph keyref="kRtePlayerStateFailed"/>。此时你需要先调用 <xref keyref="Stop_Player"/> 然后再调用 <apiname keyref="OpenWithUrl"/> 重新打开 URL 资源。如果你设置关闭了自动播放,打开资源后可以调用 <xref keyref="Play_Player"/> 进行播放。</p>
</section>
<section id="timing" deliveryTarget="details">
<title>调用时机</title>
<p>该方法需要在 <xref keyref="Player_Player"/> 之后调用。</p>
</section>
<section id="restriction" deliveryTarget="details">
<title>调用限制</title>
<p>该方法目前仅支持打开以 <codeph>rte://</codeph> 开头的 URL、CDN URL 和本地媒体文件。//TODO</p>
</section>
<section id="related" deliveryTarget="details">
<title>相关回调</title>
<p>调用该方法后会触发 <xref keyref="onStateChanged"/> 回调,报告播放器状态为 <apiname keyref="kRtePlayerStateOpening"/>,表示正在打开 URL。成功打开后,报告播放器状态为 <apiname keyref="kRtePlayerStateOpenCompleted"/>。</p>
</section>
<section id="parameters" deliveryTarget="details">
<title>参数</title>
<parml>
<plentry conkeyref="PreloadWithUrl/url">
<pt></pt>
<pd></pd>
</plentry>
<plentry>
<pt props="cpp">start_time</pt>
<pt props="android apple">startTime</pt>
<pd>起始播放位置,单位为毫秒。</pd>
</plentry>
<plentry props="cpp apple">
<pt>cb</pt>
<pd>一个异步回调函数,用于通知打开 URL 资源的结果。如果打开过程中出错,你可以通过该回调中的 <parmname>err</parmname> 参数得知具体错误信息。详见 <xref keyref="Error"/>。</pd>
</plentry>
<plentry props="android">
<pt>callback</pt>
<pd>一个异步回调函数,用于通知打开 URL 资源的结果。如果打开过程中出错,你可以通过 <xref keyref="AsyncCallback"/> 下的 <xref keyref="onResult_AsyncCallback"/> 回调得知具体错误信息。</pd>
</plentry>
</parml> </section>
</refbody>
</reference>