diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index 83bc38b217175..10772754bd6cb 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -158,18 +158,10 @@ import java.util.concurrent.Executor; * the user supplied callback method OnErrorListener.onError() will be * invoked by the internal player engine and the object will be * transfered to the Error state. - *
new is in the
+ * new is in the
* Idle state, while those created with one
* of the overloaded convenient create methods are NOT
* in the Idle state. In fact, the objects are in the Prepared
@@ -407,7 +399,7 @@ import java.util.concurrent.Executor;
* When done with the MediaPlayer, you should call {@link #release()}, - * to free the resources. If not released, too many MediaPlayer instances may - * result in an exception.
+ * Default constructor. + * + *Consider using one of the create() methods for synchronously instantiating a MediaPlayer + * from a Uri or resource. + * + *
You must call {@link #release()} when you are finished using the instantiated instance. + * Doing so frees any resources you have previously acquired. */ public MediaPlayer() { this(AudioSystem.AUDIO_SESSION_ALLOCATE); @@ -873,9 +867,10 @@ public class MediaPlayer extends PlayerBase /** * Convenience method to create a MediaPlayer for a given Uri. * On success, {@link #prepare()} will already have been called and must not be called again. - *
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.
+ * + *You must call {@link #release()} when you are finished using the created instance. Doing + * so frees any resources you have previously acquired. + * *
Note that since {@link #prepare()} is called automatically in this method, * you cannot change the audio * session ID (see {@link #setAudioSessionId(int)}) or audio attributes @@ -892,9 +887,10 @@ public class MediaPlayer extends PlayerBase /** * Convenience method to create a MediaPlayer for a given Uri. * On success, {@link #prepare()} will already have been called and must not be called again. - *
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.
+ * + *You must call {@link #release()} when you are finished using the created instance. Doing + * so frees any resources you have previously acquired. + * *
Note that since {@link #prepare()} is called automatically in this method, * you cannot change the audio * session ID (see {@link #setAudioSessionId(int)}) or audio attributes @@ -955,9 +951,10 @@ public class MediaPlayer extends PlayerBase /** * Convenience method to create a MediaPlayer for a given resource id. * On success, {@link #prepare()} will already have been called and must not be called again. - *
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.
+ * + *You must call {@link #release()} when you are finished using the created instance. Doing + * so frees any resources you have previously acquired. + * *
Note that since {@link #prepare()} is called automatically in this method, * you cannot change the audio * session ID (see {@link #setAudioSessionId(int)}) or audio attributes @@ -2157,21 +2154,8 @@ public class MediaPlayer extends PlayerBase /** * Releases resources associated with this MediaPlayer object. - * It is considered good practice to call this method when you're - * done using the MediaPlayer. In particular, whenever an Activity - * of an application is paused (its onPause() method is called), - * or stopped (its onStop() method is called), this method should be - * invoked to release the MediaPlayer object, unless the application - * has a special need to keep the object around. In addition to - * unnecessary resources (such as memory and instances of codecs) - * being held, failure to call this method immediately if a - * MediaPlayer object is no longer needed may also lead to - * continuous battery consumption for mobile devices, and playback - * failure for other applications if no multiple instances of the - * same codec are supported on a device. Even if multiple instances - * of the same codec are supported, some performance degradation - * may be expected when unnecessary multiple instances are used - * at the same time. + * + *
You must call this method once the instance is no longer required. */ public void release() { baseRelease();