1<!DOCTYPE HTML>
2<!-- NewPage -->
3<html lang="en">
4<head><!-- start favicons snippet, use https://realfavicongenerator.net/ --><link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png"><link rel="manifest" href="/assets/site.webmanifest"><link rel="mask-icon" href="/assets/safari-pinned-tab.svg" color="#fc4d50"><link rel="shortcut icon" href="/assets/favicon.ico"><meta name="msapplication-TileColor" content="#ffc40d"><meta name="msapplication-config" content="/assets/browserconfig.xml"><meta name="theme-color" content="#ffffff"><!-- end favicons snippet -->
5<title>ServerSideInsertedAdsUtil (ExoPlayer library)</title>
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
8<link rel="stylesheet" type="text/css" href="../../../../../../jquery/jquery-ui.css" title="Style">
9<script type="text/javascript" src="../../../../../../script.js"></script>
10<script type="text/javascript" src="../../../../../../jquery/jszip/dist/jszip.min.js"></script>
11<script type="text/javascript" src="../../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
12<!--[if IE]>
13<script type="text/javascript" src="../../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
14<![endif]-->
15<script type="text/javascript" src="../../../../../../jquery/jquery-3.5.1.js"></script>
16<script type="text/javascript" src="../../../../../../jquery/jquery-ui.js"></script>
17</head>
18<body>
19<script type="text/javascript"><!--
20    try {
21        if (location.href.indexOf('is-external=true') == -1) {
22            parent.document.title="ServerSideInsertedAdsUtil (ExoPlayer library)";
23        }
24    }
25    catch(err) {
26    }
27//-->
28var data = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9};
29var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
30var altColor = "altColor";
31var rowColor = "rowColor";
32var tableTab = "tableTab";
33var activeTableTab = "activeTableTab";
34var pathtoroot = "../../../../../../";
35var useModuleDirectories = false;
36loadScripts(document, 'script');</script>
37<noscript>
38<div>JavaScript is disabled on your browser.</div>
39</noscript>
40<header role="banner">
41<nav role="navigation">
42<div class="fixedNav">
43<!-- ========= START OF TOP NAVBAR ======= -->
44<div class="topNav"><a id="navbar.top">
45<!--   -->
46</a>
47<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
48<a id="navbar.top.firstrow">
49<!--   -->
50</a>
51<ul class="navList" title="Navigation">
52<li><a href="../../../../../../index.html">Overview</a></li>
53<li><a href="package-summary.html">Package</a></li>
54<li class="navBarCell1Rev">Class</li>
55<li><a href="package-tree.html">Tree</a></li>
56<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
57<li><a href="../../../../../../index-all.html">Index</a></li>
58<li><a href="../../../../../../help-doc.html">Help</a></li>
59</ul>
60</div>
61<div class="subNav">
62<ul class="navList" id="allclasses_navbar_top">
63<li><a href="../../../../../../allclasses.html">All&nbsp;Classes</a></li>
64</ul>
65<ul class="navListSearch">
66<li><label for="search">SEARCH:</label>
67<input type="text" id="search" value="search" disabled="disabled">
68<input type="reset" id="reset" value="reset" disabled="disabled">
69</li>
70</ul>
71<div>
72<script type="text/javascript"><!--
73  allClassesLink = document.getElementById("allclasses_navbar_top");
74  if(window==top) {
75    allClassesLink.style.display = "block";
76  }
77  else {
78    allClassesLink.style.display = "none";
79  }
80  //-->
81</script>
82<noscript>
83<div>JavaScript is disabled on your browser.</div>
84</noscript>
85</div>
86<div>
87<ul class="subNavList">
88<li>Summary:&nbsp;</li>
89<li>Nested&nbsp;|&nbsp;</li>
90<li>Field&nbsp;|&nbsp;</li>
91<li>Constr&nbsp;|&nbsp;</li>
92<li><a href="#method.summary">Method</a></li>
93</ul>
94<ul class="subNavList">
95<li>Detail:&nbsp;</li>
96<li>Field&nbsp;|&nbsp;</li>
97<li>Constr&nbsp;|&nbsp;</li>
98<li><a href="#method.detail">Method</a></li>
99</ul>
100</div>
101<a id="skip.navbar.top">
102<!--   -->
103</a></div>
104<!-- ========= END OF TOP NAVBAR ========= -->
105</div>
106<div class="navPadding">&nbsp;</div>
107<script type="text/javascript"><!--
108$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
109//-->
110</script>
111</nav>
112</header>
113<!-- ======== START OF CLASS DATA ======== -->
114<main role="main">
115<div class="header">
116<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">com.google.android.exoplayer2.source.ads</a></div>
117<h2 title="Class ServerSideInsertedAdsUtil" class="title">Class ServerSideInsertedAdsUtil</h2>
118</div>
119<div class="contentContainer">
120<ul class="inheritance">
121<li><a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">java.lang.Object</a></li>
122<li>
123<ul class="inheritance">
124<li>com.google.android.exoplayer2.source.ads.ServerSideInsertedAdsUtil</li>
125</ul>
126</li>
127</ul>
128<div class="description">
129<ul class="blockList">
130<li class="blockList">
131<hr>
132<pre>public final class <span class="typeNameLabel">ServerSideInsertedAdsUtil</span>
133extends <a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">Object</a></pre>
134<div class="block">A static utility class with methods to work with server-side inserted ads.</div>
135</li>
136</ul>
137</div>
138<div class="summary">
139<ul class="blockList">
140<li class="blockList">
141<!-- ========== METHOD SUMMARY =========== -->
142<section role="region">
143<ul class="blockList">
144<li class="blockList"><a id="method.summary">
145<!--   -->
146</a>
147<h3>Method Summary</h3>
148<table class="memberSummary">
149<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
150<tr>
151<th class="colFirst" scope="col">Modifier and Type</th>
152<th class="colSecond" scope="col">Method</th>
153<th class="colLast" scope="col">Description</th>
154</tr>
155<tr id="i0" class="altColor">
156<td class="colFirst"><code>static <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a></code></td>
157<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addAdGroupToAdPlaybackState(com.google.android.exoplayer2.source.ads.AdPlaybackState,long,long,long)">addAdGroupToAdPlaybackState</a></span>&#8203;(<a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState,
158                           long&nbsp;fromPositionUs,
159                           long&nbsp;toPositionUs,
160                           long&nbsp;contentResumeOffsetUs)</code></th>
161<td class="colLast">
162<div class="block">Adds a new server-side inserted ad group to an <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a>.</div>
163</td>
164</tr>
165<tr id="i1" class="rowColor">
166<td class="colFirst"><code>static int</code></td>
167<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAdCountInGroup(com.google.android.exoplayer2.source.ads.AdPlaybackState,int)">getAdCountInGroup</a></span>&#8203;(<a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState,
168                 int&nbsp;adGroupIndex)</code></th>
169<td class="colLast">
170<div class="block">Returns the number of ads in an ad group, treating an unknown number as zero ads.</div>
171</td>
172</tr>
173<tr id="i2" class="altColor">
174<td class="colFirst"><code>static long</code></td>
175<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMediaPeriodPositionUs(long,com.google.android.exoplayer2.source.MediaPeriodId,com.google.android.exoplayer2.source.ads.AdPlaybackState)">getMediaPeriodPositionUs</a></span>&#8203;(long&nbsp;positionUs,
176                        <a href="../MediaPeriodId.html" title="class in com.google.android.exoplayer2.source">MediaPeriodId</a>&nbsp;mediaPeriodId,
177                        <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</code></th>
178<td class="colLast">
179<div class="block">Returns the position in a <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a> for a position in the underlying server-side
180 inserted ads stream.</div>
181</td>
182</tr>
183<tr id="i3" class="rowColor">
184<td class="colFirst"><code>static long</code></td>
185<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMediaPeriodPositionUsForAd(long,int,int,com.google.android.exoplayer2.source.ads.AdPlaybackState)">getMediaPeriodPositionUsForAd</a></span>&#8203;(long&nbsp;positionUs,
186                             int&nbsp;adGroupIndex,
187                             int&nbsp;adIndexInAdGroup,
188                             <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</code></th>
189<td class="colLast">
190<div class="block">Returns the position in an ad <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a> for a position in the underlying server-side
191 inserted ads stream.</div>
192</td>
193</tr>
194<tr id="i4" class="altColor">
195<td class="colFirst"><code>static long</code></td>
196<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMediaPeriodPositionUsForContent(long,int,com.google.android.exoplayer2.source.ads.AdPlaybackState)">getMediaPeriodPositionUsForContent</a></span>&#8203;(long&nbsp;positionUs,
197                                  int&nbsp;nextAdGroupIndex,
198                                  <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</code></th>
199<td class="colLast">
200<div class="block">Returns the position in a content <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a> for a position in the underlying
201 server-side inserted ads stream.</div>
202</td>
203</tr>
204<tr id="i5" class="rowColor">
205<td class="colFirst"><code>static long</code></td>
206<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamDurationUs(com.google.android.exoplayer2.Player,com.google.android.exoplayer2.source.ads.AdPlaybackState)">getStreamDurationUs</a></span>&#8203;(<a href="../../Player.html" title="interface in com.google.android.exoplayer2">Player</a>&nbsp;player,
207                   <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</code></th>
208<td class="colLast">
209<div class="block">Returns the duration of the underlying server-side inserted ads stream for the current <a href="../../Timeline.Period.html" title="class in com.google.android.exoplayer2"><code>Timeline.Period</code></a> in the <a href="../../Player.html" title="interface in com.google.android.exoplayer2"><code>Player</code></a>.</div>
210</td>
211</tr>
212<tr id="i6" class="altColor">
213<td class="colFirst"><code>static long</code></td>
214<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamPositionUs(long,com.google.android.exoplayer2.source.MediaPeriodId,com.google.android.exoplayer2.source.ads.AdPlaybackState)">getStreamPositionUs</a></span>&#8203;(long&nbsp;positionUs,
215                   <a href="../MediaPeriodId.html" title="class in com.google.android.exoplayer2.source">MediaPeriodId</a>&nbsp;mediaPeriodId,
216                   <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</code></th>
217<td class="colLast">
218<div class="block">Returns the position in the underlying server-side inserted ads stream for a position in a
219 <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>.</div>
220</td>
221</tr>
222<tr id="i7" class="rowColor">
223<td class="colFirst"><code>static long</code></td>
224<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamPositionUs(com.google.android.exoplayer2.Player,com.google.android.exoplayer2.source.ads.AdPlaybackState)">getStreamPositionUs</a></span>&#8203;(<a href="../../Player.html" title="interface in com.google.android.exoplayer2">Player</a>&nbsp;player,
225                   <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</code></th>
226<td class="colLast">
227<div class="block">Returns the position in the underlying server-side inserted ads stream for the current playback
228 position in the <a href="../../Player.html" title="interface in com.google.android.exoplayer2"><code>Player</code></a>.</div>
229</td>
230</tr>
231<tr id="i8" class="altColor">
232<td class="colFirst"><code>static long</code></td>
233<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamPositionUsForAd(long,int,int,com.google.android.exoplayer2.source.ads.AdPlaybackState)">getStreamPositionUsForAd</a></span>&#8203;(long&nbsp;positionUs,
234                        int&nbsp;adGroupIndex,
235                        int&nbsp;adIndexInAdGroup,
236                        <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</code></th>
237<td class="colLast">
238<div class="block">Returns the position in the underlying server-side inserted ads stream for a position in an ad
239 <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>.</div>
240</td>
241</tr>
242<tr id="i9" class="rowColor">
243<td class="colFirst"><code>static long</code></td>
244<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamPositionUsForContent(long,int,com.google.android.exoplayer2.source.ads.AdPlaybackState)">getStreamPositionUsForContent</a></span>&#8203;(long&nbsp;positionUs,
245                             int&nbsp;nextAdGroupIndex,
246                             <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</code></th>
247<td class="colLast">
248<div class="block">Returns the position in the underlying server-side inserted ads stream for a position in a
249 content <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>.</div>
250</td>
251</tr>
252</table>
253<ul class="blockList">
254<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
255<!--   -->
256</a>
257<h3>Methods inherited from class&nbsp;java.lang.<a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">Object</a></h3>
258<code><a href="https://developer.android.com/reference/java/lang/Object.html#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink" target="_top">wait</a></code></li>
259</ul>
260</li>
261</ul>
262</section>
263</li>
264</ul>
265</div>
266<div class="details">
267<ul class="blockList">
268<li class="blockList">
269<!-- ============ METHOD DETAIL ========== -->
270<section role="region">
271<ul class="blockList">
272<li class="blockList"><a id="method.detail">
273<!--   -->
274</a>
275<h3>Method Detail</h3>
276<a id="addAdGroupToAdPlaybackState(com.google.android.exoplayer2.source.ads.AdPlaybackState,long,long,long)">
277<!--   -->
278</a>
279<ul class="blockList">
280<li class="blockList">
281<h4>addAdGroupToAdPlaybackState</h4>
282<pre class="methodSignature">@CheckResult
283public static&nbsp;<a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;addAdGroupToAdPlaybackState&#8203;(<a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState,
284                                                          long&nbsp;fromPositionUs,
285                                                          long&nbsp;toPositionUs,
286                                                          long&nbsp;contentResumeOffsetUs)</pre>
287<div class="block">Adds a new server-side inserted ad group to an <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a>.</div>
288<dl>
289<dt><span class="paramLabel">Parameters:</span></dt>
290<dd><code>adPlaybackState</code> - The existing <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a>.</dd>
291<dd><code>fromPositionUs</code> - The position in the underlying server-side inserted ads stream at which
292     the ad group starts, in microseconds.</dd>
293<dd><code>toPositionUs</code> - The position in the underlying server-side inserted ads stream at which the
294     ad group ends, in microseconds.</dd>
295<dd><code>contentResumeOffsetUs</code> - The timestamp offset which should be added to the content stream
296     when resuming playback after the ad group. An offset of 0 collapses the ad group to a
297     single insertion point, an offset of <code>toPositionUs-fromPositionUs</code> keeps the original
298     stream timestamps after the ad group.</dd>
299<dt><span class="returnLabel">Returns:</span></dt>
300<dd>The updated <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a>.</dd>
301</dl>
302</li>
303</ul>
304<a id="getStreamDurationUs(com.google.android.exoplayer2.Player,com.google.android.exoplayer2.source.ads.AdPlaybackState)">
305<!--   -->
306</a>
307<ul class="blockList">
308<li class="blockList">
309<h4>getStreamDurationUs</h4>
310<pre class="methodSignature">public static&nbsp;long&nbsp;getStreamDurationUs&#8203;(<a href="../../Player.html" title="interface in com.google.android.exoplayer2">Player</a>&nbsp;player,
311                                       <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</pre>
312<div class="block">Returns the duration of the underlying server-side inserted ads stream for the current <a href="../../Timeline.Period.html" title="class in com.google.android.exoplayer2"><code>Timeline.Period</code></a> in the <a href="../../Player.html" title="interface in com.google.android.exoplayer2"><code>Player</code></a>.</div>
313<dl>
314<dt><span class="paramLabel">Parameters:</span></dt>
315<dd><code>player</code> - The <a href="../../Player.html" title="interface in com.google.android.exoplayer2"><code>Player</code></a>.</dd>
316<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a> defining the ad groups.</dd>
317<dt><span class="returnLabel">Returns:</span></dt>
318<dd>The duration of the underlying server-side inserted ads stream, in microseconds, or
319     <a href="../../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if it can't be determined.</dd>
320</dl>
321</li>
322</ul>
323<a id="getStreamPositionUs(com.google.android.exoplayer2.Player,com.google.android.exoplayer2.source.ads.AdPlaybackState)">
324<!--   -->
325</a>
326<ul class="blockList">
327<li class="blockList">
328<h4>getStreamPositionUs</h4>
329<pre class="methodSignature">public static&nbsp;long&nbsp;getStreamPositionUs&#8203;(<a href="../../Player.html" title="interface in com.google.android.exoplayer2">Player</a>&nbsp;player,
330                                       <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</pre>
331<div class="block">Returns the position in the underlying server-side inserted ads stream for the current playback
332 position in the <a href="../../Player.html" title="interface in com.google.android.exoplayer2"><code>Player</code></a>.</div>
333<dl>
334<dt><span class="paramLabel">Parameters:</span></dt>
335<dd><code>player</code> - The <a href="../../Player.html" title="interface in com.google.android.exoplayer2"><code>Player</code></a>.</dd>
336<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a> defining the ad groups.</dd>
337<dt><span class="returnLabel">Returns:</span></dt>
338<dd>The position in the underlying server-side inserted ads stream, in microseconds, or
339     <a href="../../C.html#TIME_UNSET"><code>C.TIME_UNSET</code></a> if it can't be determined.</dd>
340</dl>
341</li>
342</ul>
343<a id="getStreamPositionUs(long,com.google.android.exoplayer2.source.MediaPeriodId,com.google.android.exoplayer2.source.ads.AdPlaybackState)">
344<!--   -->
345</a>
346<ul class="blockList">
347<li class="blockList">
348<h4>getStreamPositionUs</h4>
349<pre class="methodSignature">public static&nbsp;long&nbsp;getStreamPositionUs&#8203;(long&nbsp;positionUs,
350                                       <a href="../MediaPeriodId.html" title="class in com.google.android.exoplayer2.source">MediaPeriodId</a>&nbsp;mediaPeriodId,
351                                       <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</pre>
352<div class="block">Returns the position in the underlying server-side inserted ads stream for a position in a
353 <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>.</div>
354<dl>
355<dt><span class="paramLabel">Parameters:</span></dt>
356<dd><code>positionUs</code> - The position in the <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>, in microseconds.</dd>
357<dd><code>mediaPeriodId</code> - The <a href="../MediaPeriodId.html" title="class in com.google.android.exoplayer2.source"><code>MediaPeriodId</code></a> of the <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>.</dd>
358<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a> defining the ad groups.</dd>
359<dt><span class="returnLabel">Returns:</span></dt>
360<dd>The position in the underlying server-side inserted ads stream, in microseconds.</dd>
361</dl>
362</li>
363</ul>
364<a id="getMediaPeriodPositionUs(long,com.google.android.exoplayer2.source.MediaPeriodId,com.google.android.exoplayer2.source.ads.AdPlaybackState)">
365<!--   -->
366</a>
367<ul class="blockList">
368<li class="blockList">
369<h4>getMediaPeriodPositionUs</h4>
370<pre class="methodSignature">public static&nbsp;long&nbsp;getMediaPeriodPositionUs&#8203;(long&nbsp;positionUs,
371                                            <a href="../MediaPeriodId.html" title="class in com.google.android.exoplayer2.source">MediaPeriodId</a>&nbsp;mediaPeriodId,
372                                            <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</pre>
373<div class="block">Returns the position in a <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a> for a position in the underlying server-side
374 inserted ads stream.</div>
375<dl>
376<dt><span class="paramLabel">Parameters:</span></dt>
377<dd><code>positionUs</code> - The position in the underlying server-side inserted ads stream, in
378     microseconds.</dd>
379<dd><code>mediaPeriodId</code> - The <a href="../MediaPeriodId.html" title="class in com.google.android.exoplayer2.source"><code>MediaPeriodId</code></a> of the <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>.</dd>
380<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a> defining the ad groups.</dd>
381<dt><span class="returnLabel">Returns:</span></dt>
382<dd>The position in the <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>, in microseconds.</dd>
383</dl>
384</li>
385</ul>
386<a id="getStreamPositionUsForAd(long,int,int,com.google.android.exoplayer2.source.ads.AdPlaybackState)">
387<!--   -->
388</a>
389<ul class="blockList">
390<li class="blockList">
391<h4>getStreamPositionUsForAd</h4>
392<pre class="methodSignature">public static&nbsp;long&nbsp;getStreamPositionUsForAd&#8203;(long&nbsp;positionUs,
393                                            int&nbsp;adGroupIndex,
394                                            int&nbsp;adIndexInAdGroup,
395                                            <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</pre>
396<div class="block">Returns the position in the underlying server-side inserted ads stream for a position in an ad
397 <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>.</div>
398<dl>
399<dt><span class="paramLabel">Parameters:</span></dt>
400<dd><code>positionUs</code> - The position in the ad <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>, in microseconds.</dd>
401<dd><code>adGroupIndex</code> - The ad group index of the ad.</dd>
402<dd><code>adIndexInAdGroup</code> - The index of the ad in the ad group.</dd>
403<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a> defining the ad groups.</dd>
404<dt><span class="returnLabel">Returns:</span></dt>
405<dd>The position in the underlying server-side inserted ads stream, in microseconds.</dd>
406</dl>
407</li>
408</ul>
409<a id="getMediaPeriodPositionUsForAd(long,int,int,com.google.android.exoplayer2.source.ads.AdPlaybackState)">
410<!--   -->
411</a>
412<ul class="blockList">
413<li class="blockList">
414<h4>getMediaPeriodPositionUsForAd</h4>
415<pre class="methodSignature">public static&nbsp;long&nbsp;getMediaPeriodPositionUsForAd&#8203;(long&nbsp;positionUs,
416                                                 int&nbsp;adGroupIndex,
417                                                 int&nbsp;adIndexInAdGroup,
418                                                 <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</pre>
419<div class="block">Returns the position in an ad <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a> for a position in the underlying server-side
420 inserted ads stream.</div>
421<dl>
422<dt><span class="paramLabel">Parameters:</span></dt>
423<dd><code>positionUs</code> - The position in the underlying server-side inserted ads stream, in
424     microseconds.</dd>
425<dd><code>adGroupIndex</code> - The ad group index of the ad.</dd>
426<dd><code>adIndexInAdGroup</code> - The index of the ad in the ad group.</dd>
427<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a> defining the ad groups.</dd>
428<dt><span class="returnLabel">Returns:</span></dt>
429<dd>The position in the ad <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>, in microseconds.</dd>
430</dl>
431</li>
432</ul>
433<a id="getStreamPositionUsForContent(long,int,com.google.android.exoplayer2.source.ads.AdPlaybackState)">
434<!--   -->
435</a>
436<ul class="blockList">
437<li class="blockList">
438<h4>getStreamPositionUsForContent</h4>
439<pre class="methodSignature">public static&nbsp;long&nbsp;getStreamPositionUsForContent&#8203;(long&nbsp;positionUs,
440                                                 int&nbsp;nextAdGroupIndex,
441                                                 <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</pre>
442<div class="block">Returns the position in the underlying server-side inserted ads stream for a position in a
443 content <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>.</div>
444<dl>
445<dt><span class="paramLabel">Parameters:</span></dt>
446<dd><code>positionUs</code> - The position in the content <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>, in microseconds.</dd>
447<dd><code>nextAdGroupIndex</code> - The next ad group index after the content, or <a href="../../C.html#INDEX_UNSET"><code>C.INDEX_UNSET</code></a> if
448     there is no following ad group. Ad groups from this index are not used to adjust the
449     position.</dd>
450<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a> defining the ad groups.</dd>
451<dt><span class="returnLabel">Returns:</span></dt>
452<dd>The position in the underlying server-side inserted ads stream, in microseconds.</dd>
453</dl>
454</li>
455</ul>
456<a id="getMediaPeriodPositionUsForContent(long,int,com.google.android.exoplayer2.source.ads.AdPlaybackState)">
457<!--   -->
458</a>
459<ul class="blockList">
460<li class="blockList">
461<h4>getMediaPeriodPositionUsForContent</h4>
462<pre class="methodSignature">public static&nbsp;long&nbsp;getMediaPeriodPositionUsForContent&#8203;(long&nbsp;positionUs,
463                                                      int&nbsp;nextAdGroupIndex,
464                                                      <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState)</pre>
465<div class="block">Returns the position in a content <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a> for a position in the underlying
466 server-side inserted ads stream.</div>
467<dl>
468<dt><span class="paramLabel">Parameters:</span></dt>
469<dd><code>positionUs</code> - The position in the underlying server-side inserted ads stream, in
470     microseconds.</dd>
471<dd><code>nextAdGroupIndex</code> - The next ad group index after the content, or <a href="../../C.html#INDEX_UNSET"><code>C.INDEX_UNSET</code></a> if
472     there is no following ad group. Ad groups from this index are not used to adjust the
473     position.</dd>
474<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a> defining the ad groups.</dd>
475<dt><span class="returnLabel">Returns:</span></dt>
476<dd>The position in the content <a href="../MediaPeriod.html" title="interface in com.google.android.exoplayer2.source"><code>MediaPeriod</code></a>, in microseconds.</dd>
477</dl>
478</li>
479</ul>
480<a id="getAdCountInGroup(com.google.android.exoplayer2.source.ads.AdPlaybackState,int)">
481<!--   -->
482</a>
483<ul class="blockListLast">
484<li class="blockList">
485<h4>getAdCountInGroup</h4>
486<pre class="methodSignature">public static&nbsp;int&nbsp;getAdCountInGroup&#8203;(<a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads">AdPlaybackState</a>&nbsp;adPlaybackState,
487                                    int&nbsp;adGroupIndex)</pre>
488<div class="block">Returns the number of ads in an ad group, treating an unknown number as zero ads.</div>
489<dl>
490<dt><span class="paramLabel">Parameters:</span></dt>
491<dd><code>adPlaybackState</code> - The <a href="AdPlaybackState.html" title="class in com.google.android.exoplayer2.source.ads"><code>AdPlaybackState</code></a>.</dd>
492<dd><code>adGroupIndex</code> - The index of the ad group.</dd>
493<dt><span class="returnLabel">Returns:</span></dt>
494<dd>The number of ads in the ad group.</dd>
495</dl>
496</li>
497</ul>
498</li>
499</ul>
500</section>
501</li>
502</ul>
503</div>
504</div>
505</main>
506<!-- ========= END OF CLASS DATA ========= -->
507<footer role="contentinfo">
508<nav role="navigation">
509<!-- ======= START OF BOTTOM NAVBAR ====== -->
510<div class="bottomNav"><a id="navbar.bottom">
511<!--   -->
512</a>
513<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
514<a id="navbar.bottom.firstrow">
515<!--   -->
516</a>
517<ul class="navList" title="Navigation">
518<li><a href="../../../../../../index.html">Overview</a></li>
519<li><a href="package-summary.html">Package</a></li>
520<li class="navBarCell1Rev">Class</li>
521<li><a href="package-tree.html">Tree</a></li>
522<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
523<li><a href="../../../../../../index-all.html">Index</a></li>
524<li><a href="../../../../../../help-doc.html">Help</a></li>
525</ul>
526</div>
527<div class="subNav">
528<ul class="navList" id="allclasses_navbar_bottom">
529<li><a href="../../../../../../allclasses.html">All&nbsp;Classes</a></li>
530</ul>
531<div>
532<script type="text/javascript"><!--
533  allClassesLink = document.getElementById("allclasses_navbar_bottom");
534  if(window==top) {
535    allClassesLink.style.display = "block";
536  }
537  else {
538    allClassesLink.style.display = "none";
539  }
540  //-->
541</script>
542<noscript>
543<div>JavaScript is disabled on your browser.</div>
544</noscript>
545</div>
546<div>
547<ul class="subNavList">
548<li>Summary:&nbsp;</li>
549<li>Nested&nbsp;|&nbsp;</li>
550<li>Field&nbsp;|&nbsp;</li>
551<li>Constr&nbsp;|&nbsp;</li>
552<li><a href="#method.summary">Method</a></li>
553</ul>
554<ul class="subNavList">
555<li>Detail:&nbsp;</li>
556<li>Field&nbsp;|&nbsp;</li>
557<li>Constr&nbsp;|&nbsp;</li>
558<li><a href="#method.detail">Method</a></li>
559</ul>
560</div>
561<a id="skip.navbar.bottom">
562<!--   -->
563</a></div>
564<!-- ======== END OF BOTTOM NAVBAR ======= -->
565</nav>
566</footer>
567</body>
568</html>
569