Loading api/current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -25311,12 +25311,15 @@ package android.media { method public java.lang.Object clearNextDataSources(); method public void clearPendingCommands(); method public void close(); method public java.lang.Object deselectTrack(int); method public java.lang.Object deselectTrack(android.media.DataSourceDesc, int); method public android.media.AudioAttributes getAudioAttributes(); method public int getAudioSessionId(); method public long getBufferedPosition(); method public long getBufferedPosition(android.media.DataSourceDesc); method public android.media.DataSourceDesc getCurrentDataSource(); method public long getCurrentPosition(); method public long getDuration(); method public long getDuration(android.media.DataSourceDesc); method public float getMaxPlayerVolume(); method public android.os.PersistableBundle getMetrics(); Loading @@ -25324,10 +25327,12 @@ package android.media { method public float getPlayerVolume(); method public android.media.AudioDeviceInfo getPreferredDevice(); method public android.media.AudioDeviceInfo getRoutedDevice(); method public int getSelectedTrack(int); method public int getSelectedTrack(android.media.DataSourceDesc, int); method public int getState(); method public android.media.SyncParams getSyncParams(); method public android.media.MediaTimestamp getTimestamp(); method public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(); method public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(android.media.DataSourceDesc); method public android.media.VideoSize getVideoSize(); method public boolean isLooping(); Loading @@ -25341,6 +25346,7 @@ package android.media { method public void reset(); method public java.lang.Object seekTo(long); method public java.lang.Object seekTo(long, int); method public java.lang.Object selectTrack(int); method public java.lang.Object selectTrack(android.media.DataSourceDesc, int); method public java.lang.Object setAudioAttributes(android.media.AudioAttributes); method public java.lang.Object setAudioSessionId(int); media/java/android/media/MediaPlayer2.java +107 −9 Original line number Diff line number Diff line Loading @@ -543,6 +543,19 @@ public class MediaPlayer2 implements AutoCloseable */ public native long getCurrentPosition(); /** * Gets the duration of the current data source. * Same as {@link #getDuration(DataSourceDesc)} with * {@code dsd = getCurrentDataSource()}. * * @return the duration in milliseconds, if no duration is available * (for example, if streaming live content), -1 is returned. * @throws NullPointerException if current data source is null */ public long getDuration() { return getDuration(getCurrentDataSource()); } /** * Gets the duration of the dsd. * Loading @@ -565,6 +578,18 @@ public class MediaPlayer2 implements AutoCloseable private native long native_getDuration(long srcId); /** * Gets the buffered media source position of current data source. * Same as {@link #getBufferedPosition(DataSourceDesc)} with * {@code dsd = getCurrentDataSource()}. * * @return the current buffered media source position in milliseconds * @throws NullPointerException if current data source is null */ public long getBufferedPosition() { return getBufferedPosition(getCurrentDataSource()); } /** * Gets the buffered media source position of given dsd. * For example a buffering update of 8000 milliseconds when 5000 milliseconds of the content Loading Loading @@ -1987,6 +2012,21 @@ public class MediaPlayer2 implements AutoCloseable } }; /** * Returns a List of track information of current data source. * Same as {@link #getTrackInfo(DataSourceDesc)} with * {@code dsd = getCurrentDataSource()}. * * @return List of track info. The total number of tracks is the array length. * Must be called again if an external timed text source has been added after * addTimedTextSource method is called. * @throws IllegalStateException if it is called in an invalid state. * @throws NullPointerException if current data source is null */ public @NonNull List<TrackInfo> getTrackInfo() { return getTrackInfo(getCurrentDataSource()); } /** * Returns a List of track information. * Loading @@ -1997,7 +2037,6 @@ public class MediaPlayer2 implements AutoCloseable * @throws IllegalStateException if it is called in an invalid state. * @throws NullPointerException if dsd is null */ public @NonNull List<TrackInfo> getTrackInfo(@NonNull DataSourceDesc dsd) { if (dsd == null) { throw new NullPointerException("non-null dsd is expected"); Loading Loading @@ -2033,9 +2072,34 @@ public class MediaPlayer2 implements AutoCloseable } /** * Returns the index of the audio, video, or subtitle track currently selected for playback, * Returns the index of the audio, video, or subtitle track currently selected for playback. * The return value is an index into the array returned by {@link #getTrackInfo}, and can * be used in calls to {@link #selectTrack(int)} or {@link #deselectTrack(int)}. * Same as {@link #getSelectedTrack(DataSourceDesc, int)} with * {@code dsd = getCurrentDataSource()}. * * @param trackType should be one of {@link TrackInfo#MEDIA_TRACK_TYPE_VIDEO}, * {@link TrackInfo#MEDIA_TRACK_TYPE_AUDIO}, or * {@link TrackInfo#MEDIA_TRACK_TYPE_SUBTITLE} * @return index of the audio, video, or subtitle track currently selected for playback; * a negative integer is returned when there is no selected track for {@code trackType} or * when {@code trackType} is not one of audio, video, or subtitle. * @throws IllegalStateException if called after {@link #close()} * @throws NullPointerException if current data source is null * * @see #getTrackInfo() * @see #selectTrack(int) * @see #deselectTrack(int) */ public int getSelectedTrack(int trackType) { return getSelectedTrack(getCurrentDataSource(), trackType); } /** * Returns the index of the audio, video, or subtitle track currently selected for playback. * The return value is an index into the array returned by {@link #getTrackInfo}, and can * be used in calls to {@link #selectTrack} or {@link #deselectTrack}. * be used in calls to {@link #selectTrack(DataSourceDesc, int)} or * {@link #deselectTrack(DataSourceDesc, int)}. * * @param dsd the descriptor of data source of which you want to get selected track * @param trackType should be one of {@link TrackInfo#MEDIA_TRACK_TYPE_VIDEO}, Loading @@ -2047,9 +2111,9 @@ public class MediaPlayer2 implements AutoCloseable * @throws IllegalStateException if called after {@link #close()} * @throws NullPointerException if dsd is null * * @see #getTrackInfo * @see #selectTrack * @see #deselectTrack * @see #getTrackInfo(DataSourceDesc) * @see #selectTrack(DataSourceDesc, int) * @see #deselectTrack(DataSourceDesc, int) */ public int getSelectedTrack(@NonNull DataSourceDesc dsd, int trackType) { if (dsd == null) { Loading @@ -2072,6 +2136,23 @@ public class MediaPlayer2 implements AutoCloseable return response.getValues(0).getInt32Value(); } /** * Selects a track of current data source. * Same as {@link #selectTrack(DataSourceDesc, int)} with * {@code dsd = getCurrentDataSource()}. * * @param index the index of the track to be selected. The valid range of the index * is 0..total number of track - 1. The total number of tracks as well as the type of * each individual track can be found by calling {@link #getTrackInfo()} method. * @return a token which can be used to cancel the operation later with {@link #cancelCommand}. * * @see MediaPlayer2#getTrackInfo() */ // This is an asynchronous call. public Object selectTrack(int index) { return selectTrack(getCurrentDataSource(), index); } /** * Selects a track. * <p> Loading @@ -2096,10 +2177,10 @@ public class MediaPlayer2 implements AutoCloseable * @param dsd the descriptor of data source of which you want to select track * @param index the index of the track to be selected. The valid range of the index * is 0..total number of track - 1. The total number of tracks as well as the type of * each individual track can be found by calling {@link #getTrackInfo} method. * each individual track can be found by calling {@link #getTrackInfo(DataSourceDesc)} method. * @return a token which can be used to cancel the operation later with {@link #cancelCommand}. * * @see MediaPlayer2#getTrackInfo * @see MediaPlayer2#getTrackInfo(DataSourceDesc) */ // This is an asynchronous call. public Object selectTrack(@NonNull DataSourceDesc dsd, int index) { Loading @@ -2111,6 +2192,23 @@ public class MediaPlayer2 implements AutoCloseable }); } /** * Deselect a track of current data source. * Same as {@link #deselectTrack(DataSourceDesc, int)} with * {@code dsd = getCurrentDataSource()}. * * @param index the index of the track to be deselected. The valid range of the index * is 0..total number of tracks - 1. The total number of tracks as well as the type of * each individual track can be found by calling {@link #getTrackInfo()} method. * @return a token which can be used to cancel the operation later with {@link #cancelCommand}. * * @see MediaPlayer2#getTrackInfo() */ // This is an asynchronous call. public Object deselectTrack(int index) { return deselectTrack(getCurrentDataSource(), index); } /** * Deselect a track. * <p> Loading @@ -2124,7 +2222,7 @@ public class MediaPlayer2 implements AutoCloseable * each individual track can be found by calling {@link #getTrackInfo} method. * @return a token which can be used to cancel the operation later with {@link #cancelCommand}. * * @see MediaPlayer2#getTrackInfo * @see MediaPlayer2#getTrackInfo(DataSourceDesc) */ // This is an asynchronous call. public Object deselectTrack(@NonNull DataSourceDesc dsd, int index) { Loading Loading
api/current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -25311,12 +25311,15 @@ package android.media { method public java.lang.Object clearNextDataSources(); method public void clearPendingCommands(); method public void close(); method public java.lang.Object deselectTrack(int); method public java.lang.Object deselectTrack(android.media.DataSourceDesc, int); method public android.media.AudioAttributes getAudioAttributes(); method public int getAudioSessionId(); method public long getBufferedPosition(); method public long getBufferedPosition(android.media.DataSourceDesc); method public android.media.DataSourceDesc getCurrentDataSource(); method public long getCurrentPosition(); method public long getDuration(); method public long getDuration(android.media.DataSourceDesc); method public float getMaxPlayerVolume(); method public android.os.PersistableBundle getMetrics(); Loading @@ -25324,10 +25327,12 @@ package android.media { method public float getPlayerVolume(); method public android.media.AudioDeviceInfo getPreferredDevice(); method public android.media.AudioDeviceInfo getRoutedDevice(); method public int getSelectedTrack(int); method public int getSelectedTrack(android.media.DataSourceDesc, int); method public int getState(); method public android.media.SyncParams getSyncParams(); method public android.media.MediaTimestamp getTimestamp(); method public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(); method public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(android.media.DataSourceDesc); method public android.media.VideoSize getVideoSize(); method public boolean isLooping(); Loading @@ -25341,6 +25346,7 @@ package android.media { method public void reset(); method public java.lang.Object seekTo(long); method public java.lang.Object seekTo(long, int); method public java.lang.Object selectTrack(int); method public java.lang.Object selectTrack(android.media.DataSourceDesc, int); method public java.lang.Object setAudioAttributes(android.media.AudioAttributes); method public java.lang.Object setAudioSessionId(int);
media/java/android/media/MediaPlayer2.java +107 −9 Original line number Diff line number Diff line Loading @@ -543,6 +543,19 @@ public class MediaPlayer2 implements AutoCloseable */ public native long getCurrentPosition(); /** * Gets the duration of the current data source. * Same as {@link #getDuration(DataSourceDesc)} with * {@code dsd = getCurrentDataSource()}. * * @return the duration in milliseconds, if no duration is available * (for example, if streaming live content), -1 is returned. * @throws NullPointerException if current data source is null */ public long getDuration() { return getDuration(getCurrentDataSource()); } /** * Gets the duration of the dsd. * Loading @@ -565,6 +578,18 @@ public class MediaPlayer2 implements AutoCloseable private native long native_getDuration(long srcId); /** * Gets the buffered media source position of current data source. * Same as {@link #getBufferedPosition(DataSourceDesc)} with * {@code dsd = getCurrentDataSource()}. * * @return the current buffered media source position in milliseconds * @throws NullPointerException if current data source is null */ public long getBufferedPosition() { return getBufferedPosition(getCurrentDataSource()); } /** * Gets the buffered media source position of given dsd. * For example a buffering update of 8000 milliseconds when 5000 milliseconds of the content Loading Loading @@ -1987,6 +2012,21 @@ public class MediaPlayer2 implements AutoCloseable } }; /** * Returns a List of track information of current data source. * Same as {@link #getTrackInfo(DataSourceDesc)} with * {@code dsd = getCurrentDataSource()}. * * @return List of track info. The total number of tracks is the array length. * Must be called again if an external timed text source has been added after * addTimedTextSource method is called. * @throws IllegalStateException if it is called in an invalid state. * @throws NullPointerException if current data source is null */ public @NonNull List<TrackInfo> getTrackInfo() { return getTrackInfo(getCurrentDataSource()); } /** * Returns a List of track information. * Loading @@ -1997,7 +2037,6 @@ public class MediaPlayer2 implements AutoCloseable * @throws IllegalStateException if it is called in an invalid state. * @throws NullPointerException if dsd is null */ public @NonNull List<TrackInfo> getTrackInfo(@NonNull DataSourceDesc dsd) { if (dsd == null) { throw new NullPointerException("non-null dsd is expected"); Loading Loading @@ -2033,9 +2072,34 @@ public class MediaPlayer2 implements AutoCloseable } /** * Returns the index of the audio, video, or subtitle track currently selected for playback, * Returns the index of the audio, video, or subtitle track currently selected for playback. * The return value is an index into the array returned by {@link #getTrackInfo}, and can * be used in calls to {@link #selectTrack(int)} or {@link #deselectTrack(int)}. * Same as {@link #getSelectedTrack(DataSourceDesc, int)} with * {@code dsd = getCurrentDataSource()}. * * @param trackType should be one of {@link TrackInfo#MEDIA_TRACK_TYPE_VIDEO}, * {@link TrackInfo#MEDIA_TRACK_TYPE_AUDIO}, or * {@link TrackInfo#MEDIA_TRACK_TYPE_SUBTITLE} * @return index of the audio, video, or subtitle track currently selected for playback; * a negative integer is returned when there is no selected track for {@code trackType} or * when {@code trackType} is not one of audio, video, or subtitle. * @throws IllegalStateException if called after {@link #close()} * @throws NullPointerException if current data source is null * * @see #getTrackInfo() * @see #selectTrack(int) * @see #deselectTrack(int) */ public int getSelectedTrack(int trackType) { return getSelectedTrack(getCurrentDataSource(), trackType); } /** * Returns the index of the audio, video, or subtitle track currently selected for playback. * The return value is an index into the array returned by {@link #getTrackInfo}, and can * be used in calls to {@link #selectTrack} or {@link #deselectTrack}. * be used in calls to {@link #selectTrack(DataSourceDesc, int)} or * {@link #deselectTrack(DataSourceDesc, int)}. * * @param dsd the descriptor of data source of which you want to get selected track * @param trackType should be one of {@link TrackInfo#MEDIA_TRACK_TYPE_VIDEO}, Loading @@ -2047,9 +2111,9 @@ public class MediaPlayer2 implements AutoCloseable * @throws IllegalStateException if called after {@link #close()} * @throws NullPointerException if dsd is null * * @see #getTrackInfo * @see #selectTrack * @see #deselectTrack * @see #getTrackInfo(DataSourceDesc) * @see #selectTrack(DataSourceDesc, int) * @see #deselectTrack(DataSourceDesc, int) */ public int getSelectedTrack(@NonNull DataSourceDesc dsd, int trackType) { if (dsd == null) { Loading @@ -2072,6 +2136,23 @@ public class MediaPlayer2 implements AutoCloseable return response.getValues(0).getInt32Value(); } /** * Selects a track of current data source. * Same as {@link #selectTrack(DataSourceDesc, int)} with * {@code dsd = getCurrentDataSource()}. * * @param index the index of the track to be selected. The valid range of the index * is 0..total number of track - 1. The total number of tracks as well as the type of * each individual track can be found by calling {@link #getTrackInfo()} method. * @return a token which can be used to cancel the operation later with {@link #cancelCommand}. * * @see MediaPlayer2#getTrackInfo() */ // This is an asynchronous call. public Object selectTrack(int index) { return selectTrack(getCurrentDataSource(), index); } /** * Selects a track. * <p> Loading @@ -2096,10 +2177,10 @@ public class MediaPlayer2 implements AutoCloseable * @param dsd the descriptor of data source of which you want to select track * @param index the index of the track to be selected. The valid range of the index * is 0..total number of track - 1. The total number of tracks as well as the type of * each individual track can be found by calling {@link #getTrackInfo} method. * each individual track can be found by calling {@link #getTrackInfo(DataSourceDesc)} method. * @return a token which can be used to cancel the operation later with {@link #cancelCommand}. * * @see MediaPlayer2#getTrackInfo * @see MediaPlayer2#getTrackInfo(DataSourceDesc) */ // This is an asynchronous call. public Object selectTrack(@NonNull DataSourceDesc dsd, int index) { Loading @@ -2111,6 +2192,23 @@ public class MediaPlayer2 implements AutoCloseable }); } /** * Deselect a track of current data source. * Same as {@link #deselectTrack(DataSourceDesc, int)} with * {@code dsd = getCurrentDataSource()}. * * @param index the index of the track to be deselected. The valid range of the index * is 0..total number of tracks - 1. The total number of tracks as well as the type of * each individual track can be found by calling {@link #getTrackInfo()} method. * @return a token which can be used to cancel the operation later with {@link #cancelCommand}. * * @see MediaPlayer2#getTrackInfo() */ // This is an asynchronous call. public Object deselectTrack(int index) { return deselectTrack(getCurrentDataSource(), index); } /** * Deselect a track. * <p> Loading @@ -2124,7 +2222,7 @@ public class MediaPlayer2 implements AutoCloseable * each individual track can be found by calling {@link #getTrackInfo} method. * @return a token which can be used to cancel the operation later with {@link #cancelCommand}. * * @see MediaPlayer2#getTrackInfo * @see MediaPlayer2#getTrackInfo(DataSourceDesc) */ // This is an asynchronous call. public Object deselectTrack(@NonNull DataSourceDesc dsd, int index) { Loading