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

Commit c9af5b30 authored by Sungsoo Lim's avatar Sungsoo Lim Committed by Android (Google) Code Review
Browse files

Merge "VideoView2: Add API for MediaRouter intergration"

parents 7800fef9 af2a1ad0
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.Nullable;
import android.content.Context;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.MediaPlayerBase;
import android.media.update.ApiLoader;
import android.media.update.VideoView2Provider;
import android.media.update.ViewProvider;
@@ -32,6 +33,7 @@ import android.view.MotionEvent;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import java.util.Map;

// TODO: Use @link tag to refer MediaPlayer2 in docs once MediaPlayer2.java is submitted. Same to
@@ -271,7 +273,8 @@ public class VideoView2 extends FrameLayout {
     * background.
     *
     * @param focusGain the type of audio focus gain that will be requested, or
     *     {@link AudioManager#AUDIOFOCUS_NONE} to disable the use audio focus during playback.
     *                  {@link AudioManager#AUDIOFOCUS_NONE} to disable the use audio focus during
     *                  playback.
     */
    public void setAudioFocusRequest(int focusGain) {
        mProvider.setAudioFocusRequest_impl(focusGain);
@@ -286,6 +289,21 @@ public class VideoView2 extends FrameLayout {
        mProvider.setAudioAttributes_impl(attributes);
    }

    /**
     * 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 player                 the player to handle the selected route. If null, a default
     *                               route player will be used.
     * @throws IllegalStateException if MediaControlView2 is not set.
     */
    public void setRouteAttributes(@NonNull List<String> routeCategories,
            @Nullable MediaPlayerBase player) {
        mProvider.setRouteAttributes_impl(routeCategories, player);
    }

    /**
     * Sets video path.
     *
+3 −0
Original line number Diff line number Diff line
@@ -17,10 +17,12 @@
package android.media.update;

import android.media.AudioAttributes;
import android.media.MediaPlayerBase;
import android.net.Uri;
import android.widget.MediaControlView2;
import android.widget.VideoView2;

import java.util.List;
import java.util.Map;

/**
@@ -54,6 +56,7 @@ public interface VideoView2Provider extends ViewProvider {
    float getSpeed_impl();
    void setAudioFocusRequest_impl(int focusGain);
    void setAudioAttributes_impl(AudioAttributes attributes);
    void setRouteAttributes_impl(List<String> routeCategories, MediaPlayerBase player);
    void setVideoPath_impl(String path);
    void setVideoURI_impl(Uri uri);
    void setVideoURI_impl(Uri uri, Map<String, String> headers);