Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -14829,6 +14829,7 @@ package android.media { method public int getAudioSessionId(); method public int getCurrentPosition(); method public int getDuration(); method public int getSelectedTrack(int) throws java.lang.IllegalStateException; method public android.media.MediaPlayer.TrackInfo[] getTrackInfo() throws java.lang.IllegalStateException; method public int getVideoHeight(); method public int getVideoWidth(); Loading Loading @@ -14928,6 +14929,7 @@ package android.media { method public int getTrackType(); method public void writeToParcel(android.os.Parcel, int); field public static final int MEDIA_TRACK_TYPE_AUDIO = 2; // 0x2 field public static final int MEDIA_TRACK_TYPE_SUBTITLE = 4; // 0x4 field public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3; // 0x3 field public static final int MEDIA_TRACK_TYPE_UNKNOWN = 0; // 0x0 field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1 media/java/android/media/MediaPlayer.java +45 −1 Original line number Diff line number Diff line Loading @@ -631,6 +631,7 @@ public class MediaPlayer implements SubtitleController.Listener private static final int INVOKE_ID_SELECT_TRACK = 4; private static final int INVOKE_ID_DESELECT_TRACK = 5; private static final int INVOKE_ID_SET_VIDEO_SCALE_MODE = 6; private static final int INVOKE_ID_GET_SELECTED_TRACK = 7; /** * Create a request parcel which can be routed to the native media Loading Loading @@ -1664,7 +1665,6 @@ public class MediaPlayer implements SubtitleController.Listener public static final int MEDIA_TRACK_TYPE_VIDEO = 1; public static final int MEDIA_TRACK_TYPE_AUDIO = 2; public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3; /** @hide */ public static final int MEDIA_TRACK_TYPE_SUBTITLE = 4; final int mTrackType; Loading Loading @@ -2085,6 +2085,7 @@ public class MediaPlayer implements SubtitleController.Listener throws IllegalArgumentException, IllegalStateException { if (!availableMimeTypeForExternalSource(mimeType)) { throw new IllegalArgumentException("Illegal mimeType for timed text source: " + mimeType); } Parcel request = Parcel.obtain(); Loading @@ -2103,6 +2104,49 @@ public class MediaPlayer implements SubtitleController.Listener } } /** * 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)}. * * @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 #release()} * * @see {@link #getTrackInfo()} * @see {@link #selectTrack(int)} * @see {@link #deselectTrack(int)} */ public int getSelectedTrack(int trackType) throws IllegalStateException { if (trackType == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE && mSubtitleController != null) { SubtitleTrack subtitleTrack = mSubtitleController.getSelectedTrack(); if (subtitleTrack != null) { int index = mOutOfBandSubtitleTracks.indexOf(subtitleTrack); if (index >= 0) { return mInbandSubtitleTracks.length + index; } } } Parcel request = Parcel.obtain(); Parcel reply = Parcel.obtain(); try { request.writeInterfaceToken(IMEDIA_PLAYER); request.writeInt(INVOKE_ID_GET_SELECTED_TRACK); request.writeInt(trackType); invoke(request, reply); int selectedTrack = reply.readInt(); return selectedTrack; } finally { request.recycle(); reply.recycle(); } } /** * Selects a track. * <p> Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -14829,6 +14829,7 @@ package android.media { method public int getAudioSessionId(); method public int getCurrentPosition(); method public int getDuration(); method public int getSelectedTrack(int) throws java.lang.IllegalStateException; method public android.media.MediaPlayer.TrackInfo[] getTrackInfo() throws java.lang.IllegalStateException; method public int getVideoHeight(); method public int getVideoWidth(); Loading Loading @@ -14928,6 +14929,7 @@ package android.media { method public int getTrackType(); method public void writeToParcel(android.os.Parcel, int); field public static final int MEDIA_TRACK_TYPE_AUDIO = 2; // 0x2 field public static final int MEDIA_TRACK_TYPE_SUBTITLE = 4; // 0x4 field public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3; // 0x3 field public static final int MEDIA_TRACK_TYPE_UNKNOWN = 0; // 0x0 field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1
media/java/android/media/MediaPlayer.java +45 −1 Original line number Diff line number Diff line Loading @@ -631,6 +631,7 @@ public class MediaPlayer implements SubtitleController.Listener private static final int INVOKE_ID_SELECT_TRACK = 4; private static final int INVOKE_ID_DESELECT_TRACK = 5; private static final int INVOKE_ID_SET_VIDEO_SCALE_MODE = 6; private static final int INVOKE_ID_GET_SELECTED_TRACK = 7; /** * Create a request parcel which can be routed to the native media Loading Loading @@ -1664,7 +1665,6 @@ public class MediaPlayer implements SubtitleController.Listener public static final int MEDIA_TRACK_TYPE_VIDEO = 1; public static final int MEDIA_TRACK_TYPE_AUDIO = 2; public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3; /** @hide */ public static final int MEDIA_TRACK_TYPE_SUBTITLE = 4; final int mTrackType; Loading Loading @@ -2085,6 +2085,7 @@ public class MediaPlayer implements SubtitleController.Listener throws IllegalArgumentException, IllegalStateException { if (!availableMimeTypeForExternalSource(mimeType)) { throw new IllegalArgumentException("Illegal mimeType for timed text source: " + mimeType); } Parcel request = Parcel.obtain(); Loading @@ -2103,6 +2104,49 @@ public class MediaPlayer implements SubtitleController.Listener } } /** * 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)}. * * @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 #release()} * * @see {@link #getTrackInfo()} * @see {@link #selectTrack(int)} * @see {@link #deselectTrack(int)} */ public int getSelectedTrack(int trackType) throws IllegalStateException { if (trackType == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE && mSubtitleController != null) { SubtitleTrack subtitleTrack = mSubtitleController.getSelectedTrack(); if (subtitleTrack != null) { int index = mOutOfBandSubtitleTracks.indexOf(subtitleTrack); if (index >= 0) { return mInbandSubtitleTracks.length + index; } } } Parcel request = Parcel.obtain(); Parcel reply = Parcel.obtain(); try { request.writeInterfaceToken(IMEDIA_PLAYER); request.writeInt(INVOKE_ID_GET_SELECTED_TRACK); request.writeInt(trackType); invoke(request, reply); int selectedTrack = reply.readInt(); return selectedTrack; } finally { request.recycle(); reply.recycle(); } } /** * Selects a track. * <p> Loading