Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a915b21 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "VideoView2: MediaRouter integration with MediaSession"

parents 7075daa2 d58f1457
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.MediaPlayerInterface;
import android.media.session.MediaController;
import android.media.session.MediaSession;
import android.media.session.PlaybackState;
import android.media.update.ApiLoader;
import android.media.update.VideoView2Provider;
@@ -257,15 +258,33 @@ public class VideoView2 extends FrameLayout {
     *
     * @param routeCategories        the list of media control categories in
     *                               {@link android.support.v7.media.MediaControlIntent}
     * @param player                 the player to handle the selected route. If null, a default
     *                               route player will be used.
     * @param player                 the player to handle playback of the selected route.
     *                               If null, a default route player will be used.
     * @throws IllegalStateException if MediaControlView2 is not set.
     * @hide
     */
    public void setRouteAttributes(@NonNull List<String> routeCategories,
            @Nullable MediaPlayerInterface player) {
        mProvider.setRouteAttributes_impl(routeCategories, player);
    }

    /**
     * Sets a remote player for handling playback of the selected route from MediaControlView2.
     * If this is not called, MediaCotrolView2 will not show the route button.
     *
     * @param routeCategories        the list of media control categories in
     *                               {@link android.support.v7.media.MediaControlIntent}
     * @param sessionPlayer          the player to handle playback of the selected route.
     *                               If null, a default route player will be used.
     * @throws IllegalStateException if MediaControlView2 is not set.
     * @hide
     */
    // TODO: Use MediaPlayerBase once MediaSession2 APIs are ready.
    public void setRouteAttributes(@NonNull List<String> routeCategories,
            @Nullable MediaSession.Callback sessionPlayer) {
        mProvider.setRouteAttributes_impl(routeCategories, sessionPlayer);
    }

    /**
     * Sets video path.
     *
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.media.AudioAttributes;
import android.media.MediaPlayerInterface;
import android.media.session.MediaController;
import android.media.session.PlaybackState;
import android.media.session.MediaSession;
import android.net.Uri;
import android.widget.MediaControlView2;
import android.widget.VideoView2;
@@ -53,6 +54,8 @@ public interface VideoView2Provider extends ViewProvider {
    void setAudioFocusRequest_impl(int focusGain);
    void setAudioAttributes_impl(AudioAttributes attributes);
    void setRouteAttributes_impl(List<String> routeCategories, MediaPlayerInterface player);
    // TODO: remove setRouteAttributes_impl with MediaSession.Callback once MediaSession2 is ready.
    void setRouteAttributes_impl(List<String> routeCategories, MediaSession.Callback sessionPlayer);
    void setVideoPath_impl(String path);
    void setVideoUri_impl(Uri uri);
    void setVideoUri_impl(Uri uri, Map<String, String> headers);