mirror of
https://github.com/samsonjs/media.git
synced 2026-04-15 12:55:46 +00:00
924 lines
52 KiB
HTML
924 lines
52 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (1.8.0_101) on Wed Dec 14 17:18:30 GMT 2016 -->
|
|
<title>AudioTrack (ExoPlayer library)</title>
|
|
<meta name="date" content="2016-12-14">
|
|
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
|
<script type="text/javascript" src="../../../../../script.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="AudioTrack (ExoPlayer library)";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10};
|
|
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
|
var altColor = "altColor";
|
|
var rowColor = "rowColor";
|
|
var tableTab = "tableTab";
|
|
var activeTableTab = "activeTableTab";
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar.top">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.top.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../../../com/google/android/exoplayer/audio/AudioCapabilitiesReceiver.Listener.html" title="interface in com.google.android.exoplayer.audio"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InitializationException.html" title="class in com.google.android.exoplayer.audio"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../../../index.html?com/google/android/exoplayer/audio/AudioTrack.html" target="_top">Frames</a></li>
|
|
<li><a href="AudioTrack.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li><a href="#nested.class.summary">Nested</a> | </li>
|
|
<li><a href="#field.summary">Field</a> | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#field.detail">Field</a> | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">com.google.android.exoplayer.audio</div>
|
|
<h2 title="Class AudioTrack" class="title">Class AudioTrack</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>com.google.android.exoplayer.audio.AudioTrack</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<hr>
|
|
<br>
|
|
<pre>public final class <span class="typeNameLabel">AudioTrack</span>
|
|
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
|
|
<div class="block">Plays audio data. The implementation delegates to an <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true" title="class or interface in android.media"><code>AudioTrack</code></a> and handles
|
|
playback position smoothing, non-blocking writes and reconfiguration.
|
|
<p>
|
|
Before starting playback, specify the input audio format by calling one of the <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#configure-java.lang.String-int-int-int-"><code>configure(java.lang.String, int, int, int)</code></a>
|
|
methods and <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize--"><code>initialize()</code></a> the instance, optionally specifying an audio session.
|
|
<p>
|
|
Call <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(ByteBuffer, int, int, long)</code></a> to write data to play back, and
|
|
<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleDiscontinuity--"><code>handleDiscontinuity()</code></a> when a buffer is skipped. Call <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#play--"><code>play()</code></a> to start playing
|
|
back written data.
|
|
<p>
|
|
Call <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#configure-java.lang.String-int-int-int-"><code>configure(java.lang.String, int, int, int)</code></a> again whenever the input format changes. If <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#isInitialized--"><code>isInitialized()</code></a>
|
|
returns false after calling <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#configure-java.lang.String-int-int-int-"><code>configure(java.lang.String, int, int, int)</code></a>, it is necessary to re-<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize--"><code>initialize()</code></a> the
|
|
instance before writing more data.
|
|
<p>
|
|
The underlying framework audio track is created by <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize--"><code>initialize()</code></a> and released
|
|
asynchronously by <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#reset--"><code>reset()</code></a> (and <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#configure-java.lang.String-int-int-int-"><code>configure(java.lang.String, int, int, int)</code></a>, unless the format is unchanged).
|
|
Reinitialization blocks until releasing the old audio track completes. It is safe to
|
|
re-<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize--"><code>initialize()</code></a> the instance after calling <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#reset--"><code>reset()</code></a>, without reconfiguration.
|
|
<p>
|
|
Call <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#release--"><code>release()</code></a> when the instance will no longer be used.</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ======== NESTED CLASS SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="nested.class.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Nested Class Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
|
|
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Class and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static class </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InitializationException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.InitializationException</a></span></code>
|
|
<div class="block">Thrown when a failure occurs instantiating an <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true" title="class or interface in android.media"><code>AudioTrack</code></a>.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>static class </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InvalidAudioTrackTimestampException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.InvalidAudioTrackTimestampException</a></span></code>
|
|
<div class="block">Thrown when <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true#getTimestamp-android.media.AudioTimestamp-" title="class or interface in android.media"><code>AudioTrack.getTimestamp(android.media.AudioTimestamp)</code></a> returns a spurious timestamp, if
|
|
<code>AudioTrack#failOnSpuriousAudioTimestamp</code> is set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static class </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.WriteException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.WriteException</a></span></code>
|
|
<div class="block">Thrown when a failure occurs writing to an <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true" title="class or interface in android.media"><code>AudioTrack</code></a>.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- =========== FIELD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="field.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Field Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
|
|
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Field and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#CURRENT_POSITION_NOT_SET">CURRENT_POSITION_NOT_SET</a></span></code>
|
|
<div class="block">Returned by <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#getCurrentPositionUs-boolean-"><code>getCurrentPositionUs(boolean)</code></a> when the position is not set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>static boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#enablePreV21AudioSessionWorkaround">enablePreV21AudioSessionWorkaround</a></span></code>
|
|
<div class="block">Whether to enable a workaround for an issue where an audio effect does not keep its session
|
|
active across releasing/initializing a new audio track, on platform API version < 21.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#failOnSpuriousAudioTimestamp">failOnSpuriousAudioTimestamp</a></span></code>
|
|
<div class="block">Whether to throw an <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InvalidAudioTrackTimestampException.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack.InvalidAudioTrackTimestampException</code></a> when a spurious timestamp is
|
|
reported from <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true#getTimestamp-android.media.AudioTimestamp-" title="class or interface in android.media"><code>AudioTrack.getTimestamp(android.media.AudioTimestamp)</code></a>.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>static int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#RESULT_BUFFER_CONSUMED">RESULT_BUFFER_CONSUMED</a></span></code>
|
|
<div class="block">Returned in the result of <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(java.nio.ByteBuffer, int, int, long)</code></a> if the buffer can be released.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#RESULT_POSITION_DISCONTINUITY">RESULT_POSITION_DISCONTINUITY</a></span></code>
|
|
<div class="block">Returned in the result of <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(java.nio.ByteBuffer, int, int, long)</code></a> if the buffer was discontinuous.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>static int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#SESSION_ID_NOT_SET">SESSION_ID_NOT_SET</a></span></code>
|
|
<div class="block">Represents an unset <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true" title="class or interface in android.media"><code>AudioTrack</code></a> session identifier.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colOne" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#AudioTrack--">AudioTrack</a></span>()</code>
|
|
<div class="block">Creates an audio track with default audio capabilities (no encoded audio passthrough support).</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#AudioTrack-com.google.android.exoplayer.audio.AudioCapabilities-int-">AudioTrack</a></span>(<a href="../../../../../com/google/android/exoplayer/audio/AudioCapabilities.html" title="class in com.google.android.exoplayer.audio">AudioCapabilities</a> audioCapabilities,
|
|
int streamType)</code>
|
|
<div class="block">Creates an audio track using the specified audio capabilities and stream type.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr id="i0" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#configure-java.lang.String-int-int-int-">configure</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> mimeType,
|
|
int channelCount,
|
|
int sampleRate,
|
|
int pcmEncoding)</code>
|
|
<div class="block">Configures (or reconfigures) the audio track, inferring a suitable buffer size automatically.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#configure-java.lang.String-int-int-int-int-">configure</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> mimeType,
|
|
int channelCount,
|
|
int sampleRate,
|
|
int pcmEncoding,
|
|
int specifiedBufferSize)</code>
|
|
<div class="block">Configures (or reconfigures) the audio track.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i2" class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#getBufferSize--">getBufferSize</a></span>()</code>
|
|
<div class="block">Returns the size of this <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack</code></a>'s buffer in bytes.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#getBufferSizeUs--">getBufferSizeUs</a></span>()</code>
|
|
<div class="block">Returns the size of the buffer in microseconds for PCM <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack</code></a>s, or
|
|
<a href="../../../../../com/google/android/exoplayer/C.html#UNKNOWN_TIME_US"><code>C.UNKNOWN_TIME_US</code></a> for passthrough <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack</code></a>s.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i4" class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#getCurrentPositionUs-boolean-">getCurrentPositionUs</a></span>(boolean sourceEnded)</code>
|
|
<div class="block">Returns the playback position in the stream starting at zero, in microseconds, or
|
|
<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#CURRENT_POSITION_NOT_SET"><code>CURRENT_POSITION_NOT_SET</code></a> if it is not yet available.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i5" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-">handleBuffer</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> buffer,
|
|
int offset,
|
|
int size,
|
|
long presentationTimeUs)</code>
|
|
<div class="block">Attempts to write <code>size</code> bytes from <code>buffer</code> at <code>offset</code> to the audio track.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i6" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleDiscontinuity--">handleDiscontinuity</a></span>()</code>
|
|
<div class="block">Signals to the audio track that the next buffer is discontinuous with the previous buffer.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i7" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleEndOfStream--">handleEndOfStream</a></span>()</code>
|
|
<div class="block">Ensures that the last data passed to <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(ByteBuffer, int, int, long)</code></a> is
|
|
played out in full.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i8" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#hasPendingData--">hasPendingData</a></span>()</code>
|
|
<div class="block">Returns whether the audio track has more data pending that will be played back.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i9" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize--">initialize</a></span>()</code>
|
|
<div class="block">Initializes the audio track for writing new buffers using <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(java.nio.ByteBuffer, int, int, long)</code></a>.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i10" class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize-int-">initialize</a></span>(int sessionId)</code>
|
|
<div class="block">Initializes the audio track for writing new buffers using <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(java.nio.ByteBuffer, int, int, long)</code></a>.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i11" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#isInitialized--">isInitialized</a></span>()</code>
|
|
<div class="block">Returns whether the audio track has been successfully initialized via <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize--"><code>initialize()</code></a> and
|
|
not yet <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#reset--"><code>reset()</code></a>.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i12" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#isPassthroughSupported-java.lang.String-">isPassthroughSupported</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> mimeType)</code>
|
|
<div class="block">Returns whether it is possible to play back input audio in the specified format using encoded
|
|
audio passthrough.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i13" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#pause--">pause</a></span>()</code>
|
|
<div class="block">Pauses playback.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i14" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#play--">play</a></span>()</code>
|
|
<div class="block">Starts or resumes playing audio if the audio track has been initialized.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i15" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#release--">release</a></span>()</code>
|
|
<div class="block">Releases all resources associated with this instance.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i16" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#reset--">reset</a></span>()</code>
|
|
<div class="block">Releases the underlying audio track asynchronously.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i17" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#setPlaybackParams-android.media.PlaybackParams-">setPlaybackParams</a></span>(<a href="https://developer.android.com/reference/android/media/PlaybackParams.html?is-external=true" title="class or interface in android.media">PlaybackParams</a> playbackParams)</code>
|
|
<div class="block">Sets the playback parameters.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i18" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#setStreamType-int-">setStreamType</a></span>(int streamType)</code>
|
|
<div class="block">Sets the stream type for audio track.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i19" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#setVolume-float-">setVolume</a></span>(float volume)</code>
|
|
<div class="block">Sets the playback volume.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
|
|
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ============ FIELD DETAIL =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="field.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Field Detail</h3>
|
|
<a name="RESULT_POSITION_DISCONTINUITY">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>RESULT_POSITION_DISCONTINUITY</h4>
|
|
<pre>public static final int RESULT_POSITION_DISCONTINUITY</pre>
|
|
<div class="block">Returned in the result of <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(java.nio.ByteBuffer, int, int, long)</code></a> if the buffer was discontinuous.</div>
|
|
<dl>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer.audio.AudioTrack.RESULT_POSITION_DISCONTINUITY">Constant Field Values</a></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="RESULT_BUFFER_CONSUMED">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>RESULT_BUFFER_CONSUMED</h4>
|
|
<pre>public static final int RESULT_BUFFER_CONSUMED</pre>
|
|
<div class="block">Returned in the result of <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(java.nio.ByteBuffer, int, int, long)</code></a> if the buffer can be released.</div>
|
|
<dl>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer.audio.AudioTrack.RESULT_BUFFER_CONSUMED">Constant Field Values</a></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="SESSION_ID_NOT_SET">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>SESSION_ID_NOT_SET</h4>
|
|
<pre>public static final int SESSION_ID_NOT_SET</pre>
|
|
<div class="block">Represents an unset <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true" title="class or interface in android.media"><code>AudioTrack</code></a> session identifier.</div>
|
|
<dl>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer.audio.AudioTrack.SESSION_ID_NOT_SET">Constant Field Values</a></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="CURRENT_POSITION_NOT_SET">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>CURRENT_POSITION_NOT_SET</h4>
|
|
<pre>public static final long CURRENT_POSITION_NOT_SET</pre>
|
|
<div class="block">Returned by <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#getCurrentPositionUs-boolean-"><code>getCurrentPositionUs(boolean)</code></a> when the position is not set.</div>
|
|
<dl>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer.audio.AudioTrack.CURRENT_POSITION_NOT_SET">Constant Field Values</a></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="enablePreV21AudioSessionWorkaround">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>enablePreV21AudioSessionWorkaround</h4>
|
|
<pre>public static boolean enablePreV21AudioSessionWorkaround</pre>
|
|
<div class="block">Whether to enable a workaround for an issue where an audio effect does not keep its session
|
|
active across releasing/initializing a new audio track, on platform API version < 21.
|
|
<p>
|
|
The flag must be set before creating a player.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="failOnSpuriousAudioTimestamp">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>failOnSpuriousAudioTimestamp</h4>
|
|
<pre>public static boolean failOnSpuriousAudioTimestamp</pre>
|
|
<div class="block">Whether to throw an <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InvalidAudioTrackTimestampException.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack.InvalidAudioTrackTimestampException</code></a> when a spurious timestamp is
|
|
reported from <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true#getTimestamp-android.media.AudioTimestamp-" title="class or interface in android.media"><code>AudioTrack.getTimestamp(android.media.AudioTimestamp)</code></a>.
|
|
<p>
|
|
The flag must be set before creating a player. Should be set to <code>true</code> for testing and
|
|
debugging purposes only.</div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Detail</h3>
|
|
<a name="AudioTrack--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>AudioTrack</h4>
|
|
<pre>public AudioTrack()</pre>
|
|
<div class="block">Creates an audio track with default audio capabilities (no encoded audio passthrough support).</div>
|
|
</li>
|
|
</ul>
|
|
<a name="AudioTrack-com.google.android.exoplayer.audio.AudioCapabilities-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>AudioTrack</h4>
|
|
<pre>public AudioTrack(<a href="../../../../../com/google/android/exoplayer/audio/AudioCapabilities.html" title="class in com.google.android.exoplayer.audio">AudioCapabilities</a> audioCapabilities,
|
|
int streamType)</pre>
|
|
<div class="block">Creates an audio track using the specified audio capabilities and stream type.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>audioCapabilities</code> - The current audio playback capabilities.</dd>
|
|
<dd><code>streamType</code> - The type of audio stream for the underlying <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true" title="class or interface in android.media"><code>AudioTrack</code></a>.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a name="isPassthroughSupported-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isPassthroughSupported</h4>
|
|
<pre>public boolean isPassthroughSupported(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> mimeType)</pre>
|
|
<div class="block">Returns whether it is possible to play back input audio in the specified format using encoded
|
|
audio passthrough.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="isInitialized--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isInitialized</h4>
|
|
<pre>public boolean isInitialized()</pre>
|
|
<div class="block">Returns whether the audio track has been successfully initialized via <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize--"><code>initialize()</code></a> and
|
|
not yet <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#reset--"><code>reset()</code></a>.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="getCurrentPositionUs-boolean-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getCurrentPositionUs</h4>
|
|
<pre>public long getCurrentPositionUs(boolean sourceEnded)</pre>
|
|
<div class="block">Returns the playback position in the stream starting at zero, in microseconds, or
|
|
<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#CURRENT_POSITION_NOT_SET"><code>CURRENT_POSITION_NOT_SET</code></a> if it is not yet available.
|
|
|
|
<p>If the device supports it, the method uses the playback timestamp from
|
|
<a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true#getTimestamp-android.media.AudioTimestamp-" title="class or interface in android.media"><code>AudioTrack.getTimestamp(android.media.AudioTimestamp)</code></a>. Otherwise, it derives a smoothed position by
|
|
sampling the <a href="https://developer.android.com/reference/android/media/AudioTrack.html?is-external=true" title="class or interface in android.media"><code>AudioTrack</code></a>'s frame position.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>sourceEnded</code> - Specify <code>true</code> if no more input buffers will be provided.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The playback position relative to the start of playback, in microseconds.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="configure-java.lang.String-int-int-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>configure</h4>
|
|
<pre>public void configure(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> mimeType,
|
|
int channelCount,
|
|
int sampleRate,
|
|
int pcmEncoding)</pre>
|
|
<div class="block">Configures (or reconfigures) the audio track, inferring a suitable buffer size automatically.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>mimeType</code> - The mime type.</dd>
|
|
<dd><code>channelCount</code> - The number of channels.</dd>
|
|
<dd><code>sampleRate</code> - The sample rate in Hz.</dd>
|
|
<dd><code>pcmEncoding</code> - For PCM formats, the encoding used. One of <a href="../../../../../com/google/android/exoplayer/C.html#ENCODING_PCM_16BIT"><code>C.ENCODING_PCM_16BIT</code></a>,
|
|
<a href="../../../../../com/google/android/exoplayer/C.html#ENCODING_PCM_16BIT"><code>C.ENCODING_PCM_16BIT</code></a>, <a href="../../../../../com/google/android/exoplayer/C.html#ENCODING_PCM_24BIT"><code>C.ENCODING_PCM_24BIT</code></a> and
|
|
<a href="../../../../../com/google/android/exoplayer/C.html#ENCODING_PCM_32BIT"><code>C.ENCODING_PCM_32BIT</code></a>.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="configure-java.lang.String-int-int-int-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>configure</h4>
|
|
<pre>public void configure(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> mimeType,
|
|
int channelCount,
|
|
int sampleRate,
|
|
int pcmEncoding,
|
|
int specifiedBufferSize)</pre>
|
|
<div class="block">Configures (or reconfigures) the audio track.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>mimeType</code> - The mime type.</dd>
|
|
<dd><code>channelCount</code> - The number of channels.</dd>
|
|
<dd><code>sampleRate</code> - The sample rate in Hz.</dd>
|
|
<dd><code>pcmEncoding</code> - For PCM formats, the encoding used. One of <a href="../../../../../com/google/android/exoplayer/C.html#ENCODING_PCM_16BIT"><code>C.ENCODING_PCM_16BIT</code></a>,
|
|
<a href="../../../../../com/google/android/exoplayer/C.html#ENCODING_PCM_16BIT"><code>C.ENCODING_PCM_16BIT</code></a>, <a href="../../../../../com/google/android/exoplayer/C.html#ENCODING_PCM_24BIT"><code>C.ENCODING_PCM_24BIT</code></a> and
|
|
<a href="../../../../../com/google/android/exoplayer/C.html#ENCODING_PCM_32BIT"><code>C.ENCODING_PCM_32BIT</code></a>.</dd>
|
|
<dd><code>specifiedBufferSize</code> - A specific size for the playback buffer in bytes, or 0 to infer a
|
|
suitable buffer size automatically.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="initialize--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>initialize</h4>
|
|
<pre>public int initialize()
|
|
throws <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InitializationException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.InitializationException</a></pre>
|
|
<div class="block">Initializes the audio track for writing new buffers using <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(java.nio.ByteBuffer, int, int, long)</code></a>.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The audio track session identifier.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InitializationException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.InitializationException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="initialize-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>initialize</h4>
|
|
<pre>public int initialize(int sessionId)
|
|
throws <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InitializationException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.InitializationException</a></pre>
|
|
<div class="block">Initializes the audio track for writing new buffers using <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(java.nio.ByteBuffer, int, int, long)</code></a>.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>sessionId</code> - Audio track session identifier to re-use, or <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#SESSION_ID_NOT_SET"><code>SESSION_ID_NOT_SET</code></a> to
|
|
create a new one.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The new (or re-used) session identifier.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InitializationException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.InitializationException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getBufferSize--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getBufferSize</h4>
|
|
<pre>public int getBufferSize()</pre>
|
|
<div class="block">Returns the size of this <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack</code></a>'s buffer in bytes.
|
|
<p>
|
|
The value returned from this method may change as a result of calling one of the
|
|
<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#configure-java.lang.String-int-int-int-"><code>configure(java.lang.String, int, int, int)</code></a> methods.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The size of the buffer in bytes.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getBufferSizeUs--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getBufferSizeUs</h4>
|
|
<pre>public long getBufferSizeUs()</pre>
|
|
<div class="block">Returns the size of the buffer in microseconds for PCM <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack</code></a>s, or
|
|
<a href="../../../../../com/google/android/exoplayer/C.html#UNKNOWN_TIME_US"><code>C.UNKNOWN_TIME_US</code></a> for passthrough <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack</code></a>s.
|
|
<p>
|
|
The value returned from this method may change as a result of calling one of the
|
|
<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#configure-java.lang.String-int-int-int-"><code>configure(java.lang.String, int, int, int)</code></a> methods.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The size of the buffer in microseconds for PCM <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack</code></a>s, or
|
|
<a href="../../../../../com/google/android/exoplayer/C.html#UNKNOWN_TIME_US"><code>C.UNKNOWN_TIME_US</code></a> for passthrough <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html" title="class in com.google.android.exoplayer.audio"><code>AudioTrack</code></a>s.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="play--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>play</h4>
|
|
<pre>public void play()</pre>
|
|
<div class="block">Starts or resumes playing audio if the audio track has been initialized.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="handleDiscontinuity--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>handleDiscontinuity</h4>
|
|
<pre>public void handleDiscontinuity()</pre>
|
|
<div class="block">Signals to the audio track that the next buffer is discontinuous with the previous buffer.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="handleBuffer-java.nio.ByteBuffer-int-int-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>handleBuffer</h4>
|
|
<pre>public int handleBuffer(<a href="http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> buffer,
|
|
int offset,
|
|
int size,
|
|
long presentationTimeUs)
|
|
throws <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.WriteException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.WriteException</a></pre>
|
|
<div class="block">Attempts to write <code>size</code> bytes from <code>buffer</code> at <code>offset</code> to the audio track.
|
|
Returns a bit field containing <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#RESULT_BUFFER_CONSUMED"><code>RESULT_BUFFER_CONSUMED</code></a> if the buffer can be released
|
|
(due to having been written), and <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#RESULT_POSITION_DISCONTINUITY"><code>RESULT_POSITION_DISCONTINUITY</code></a> if the buffer was
|
|
discontinuous with previously written data.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>buffer</code> - The buffer containing audio data to play back.</dd>
|
|
<dd><code>offset</code> - The offset in the buffer from which to consume data.</dd>
|
|
<dd><code>size</code> - The number of bytes to consume from <code>buffer</code>.</dd>
|
|
<dd><code>presentationTimeUs</code> - Presentation timestamp of the next buffer in microseconds.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A bit field with <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#RESULT_BUFFER_CONSUMED"><code>RESULT_BUFFER_CONSUMED</code></a> if the buffer can be released, and
|
|
<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#RESULT_POSITION_DISCONTINUITY"><code>RESULT_POSITION_DISCONTINUITY</code></a> if the buffer was not contiguous with previously
|
|
written data.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.WriteException.html" title="class in com.google.android.exoplayer.audio">AudioTrack.WriteException</a></code> - If an error occurs writing the audio data.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="handleEndOfStream--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>handleEndOfStream</h4>
|
|
<pre>public void handleEndOfStream()</pre>
|
|
<div class="block">Ensures that the last data passed to <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#handleBuffer-java.nio.ByteBuffer-int-int-long-"><code>handleBuffer(ByteBuffer, int, int, long)</code></a> is
|
|
played out in full.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="hasPendingData--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>hasPendingData</h4>
|
|
<pre>public boolean hasPendingData()</pre>
|
|
<div class="block">Returns whether the audio track has more data pending that will be played back.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="setPlaybackParams-android.media.PlaybackParams-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setPlaybackParams</h4>
|
|
<pre>public void setPlaybackParams(<a href="https://developer.android.com/reference/android/media/PlaybackParams.html?is-external=true" title="class or interface in android.media">PlaybackParams</a> playbackParams)</pre>
|
|
<div class="block">Sets the playback parameters. Only available for SDK_INT >= 23</div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang">UnsupportedOperationException</a></code> - if the Playback Parameters are not supported. That is,
|
|
SDK_INT < 23.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setStreamType-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setStreamType</h4>
|
|
<pre>public boolean setStreamType(int streamType)</pre>
|
|
<div class="block">Sets the stream type for audio track. If the stream type has changed, <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#isInitialized--"><code>isInitialized()</code></a>
|
|
will return <code>false</code> and the caller must re-<a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize-int-"><code>initialize(int)</code></a> the audio track
|
|
before writing more data. The caller must not reuse the audio session identifier when
|
|
re-initializing with a new stream type.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>streamType</code> - The stream type to use for audio output.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>Whether the stream type changed.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setVolume-float-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setVolume</h4>
|
|
<pre>public void setVolume(float volume)</pre>
|
|
<div class="block">Sets the playback volume.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="pause--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>pause</h4>
|
|
<pre>public void pause()</pre>
|
|
<div class="block">Pauses playback.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="reset--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>reset</h4>
|
|
<pre>public void reset()</pre>
|
|
<div class="block">Releases the underlying audio track asynchronously. Calling <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#initialize--"><code>initialize()</code></a> will block
|
|
until the audio track has been released, so it is safe to initialize immediately after
|
|
resetting. The audio session may remain active until the instance is <a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.html#release--"><code>release()</code></a>d.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="release--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>release</h4>
|
|
<pre>public void release()</pre>
|
|
<div class="block">Releases all resources associated with this instance.</div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a name="navbar.bottom">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.bottom.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../../../com/google/android/exoplayer/audio/AudioCapabilitiesReceiver.Listener.html" title="interface in com.google.android.exoplayer.audio"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../../../../com/google/android/exoplayer/audio/AudioTrack.InitializationException.html" title="class in com.google.android.exoplayer.audio"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../../../index.html?com/google/android/exoplayer/audio/AudioTrack.html" target="_top">Frames</a></li>
|
|
<li><a href="AudioTrack.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li><a href="#nested.class.summary">Nested</a> | </li>
|
|
<li><a href="#field.summary">Field</a> | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#field.detail">Field</a> | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
</body>
|
|
</html>
|