summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-07-15 15:42:25 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2014-07-16 14:41:06 +0000
commit79f5cd1429d37044a48af5d73d2003f43fd99318 (patch)
treee79919e33303c58b09448da01a9b5e3454fc2e5c /media/java
parent63602e56bc641bb6d0547349c86d2b2fab5645be (diff)
downloadframeworks_base-79f5cd1429d37044a48af5d73d2003f43fd99318.zip
frameworks_base-79f5cd1429d37044a48af5d73d2003f43fd99318.tar.gz
frameworks_base-79f5cd1429d37044a48af5d73d2003f43fd99318.tar.bz2
Unhide MediaPlayer.setAudioAttributes(), javadoc clarifications
Unhide MediaPlayer.setAudioAttributes() method. Update javadoc to explicitly state that the factory methods do not let you set the audio stream type, attributes or session. Change-Id: I0d097c314db010698b035349befe0659ab4d1dde
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/media/MediaPlayer.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index ab65ba0..5e398c6 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -378,6 +378,13 @@ import java.lang.ref.WeakReference;
* <td>Successful invoke of this method in a valid state does not change
* the state. Calling this method in an invalid state transfers the
* object to the <em>Error</em> state. </p></td></tr>
+ * <tr><td>setAudioAttributes </p></td>
+ * <td>{Idle, Initialized, Stopped, Prepared, Started, Paused,
+ * PlaybackCompleted}</p></td>
+ * <td>{Error}</p></td>
+ * <td>Successful invoke of this method does not change the state. In order for the
+ * target audio attributes type to become effective, this method must be called before
+ * prepare() or prepareAsync().</p></td></tr>
* <tr><td>setAudioSessionId </p></td>
* <td>{Idle} </p></td>
* <td>{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted,
@@ -787,6 +794,10 @@ public class MediaPlayer implements SubtitleController.Listener
* <p>When done with the MediaPlayer, you should call {@link #release()},
* to free the resources. If not released, too many MediaPlayer instances will
* result in an exception.</p>
+ * <p>Note that since {@link #prepare()} is called automatically in this method,
+ * you cannot change the audio stream type (see {@link #setAudioStreamType(int)}), audio
+ * session ID (see {@link #setAudioSessionId(int)}) or audio attributes
+ * (see {@link #setAudioAttributes(AudioAttributes)} of the new MediaPlayer.</p>
*
* @param context the Context to use
* @param uri the Uri from which to get the datasource
@@ -802,6 +813,10 @@ public class MediaPlayer implements SubtitleController.Listener
* <p>When done with the MediaPlayer, you should call {@link #release()},
* to free the resources. If not released, too many MediaPlayer instances will
* result in an exception.</p>
+ * <p>Note that since {@link #prepare()} is called automatically in this method,
+ * you cannot change the audio stream type (see {@link #setAudioStreamType(int)}), audio
+ * session ID (see {@link #setAudioSessionId(int)}) or audio attributes
+ * (see {@link #setAudioAttributes(AudioAttributes)} of the new MediaPlayer.</p>
*
* @param context the Context to use
* @param uri the Uri from which to get the datasource
@@ -840,6 +855,10 @@ public class MediaPlayer implements SubtitleController.Listener
* <p>When done with the MediaPlayer, you should call {@link #release()},
* to free the resources. If not released, too many MediaPlayer instances will
* result in an exception.</p>
+ * <p>Note that since {@link #prepare()} is called automatically in this method,
+ * you cannot change the audio stream type (see {@link #setAudioStreamType(int)}), audio
+ * session ID (see {@link #setAudioSessionId(int)}) or audio attributes
+ * (see {@link #setAudioAttributes(AudioAttributes)} of the new MediaPlayer.</p>
*
* @param context the Context to use
* @param resid the raw resource id (<var>R.raw.&lt;something></var>) for
@@ -1454,16 +1473,15 @@ public class MediaPlayer implements SubtitleController.Listener
private native boolean setParameter(int key, Parcel value);
/**
- * @hide
- * CANDIDATE FOR PUBLIC API
- * Must call this method before prepare() or
- * prepareAsync() in order for the audio attributes to become effective
- * thereafter.
+ * Sets the audio attributes for this MediaPlayer.
+ * See {@link AudioAttributes} for how to build and configure an instance of this class.
+ * You must call this method before {@link #prepare()} or {@link #prepareAsync()} in order
+ * for the audio attributes to become effective thereafter.
* @param attributes a non-null set of audio attributes
*/
public void setAudioAttributes(AudioAttributes attributes) throws IllegalArgumentException {
if (attributes == null) {
- final String msg = "Cannot set audio attributes to null";
+ final String msg = "Cannot set AudioAttributes to null";
throw new IllegalArgumentException(msg);
}
Parcel pattributes = Parcel.obtain();