import android.media.AudioManager;
import android.media.MediaPlayerBase;
import android.media.session.MediaController;
+import android.media.session.PlaybackState;
import android.media.update.ApiLoader;
import android.media.update.VideoView2Provider;
import android.media.update.ViewProvider;
import android.net.Uri;
+import android.os.Bundle;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
}
/**
+ * Sets custom actions which will be shown as custom buttons in {@link MediaControlView2}.
+ *
+ * @param actionList A list of {@link PlaybackState.CustomAction}. The return value of
+ * {@link PlaybackState.CustomAction#getIcon()} will be used to draw buttons
+ * in {@link MediaControlView2}.
+ * @param listener A listener to be called when a custom button is clicked.
+ */
+ public void setCustomActions(List<PlaybackState.CustomAction> actionList,
+ OnCustomActionListener listener) {
+ mProvider.setCustomActions_impl(actionList, listener);
+ }
+
+ /**
* Registers a callback to be invoked when the media file is loaded and ready to go.
*
* @param l the callback that will be run.
void onFullScreenChanged(boolean fullScreen);
}
+ /**
+ * Interface definition of a callback to be invoked to inform that a custom action is performed.
+ *
+ * TODO: When MediaSession2 is ready, modify the method to match the signature.
+ */
+ public interface OnCustomActionListener {
+ /**
+ * Called to indicate that a custom action is performed.
+ *
+ * @param action The action that was originally sent in the
+ * {@link PlaybackState.CustomAction}.
+ * @param extras Optional extras.
+ */
+ void onCustomAction(String action, Bundle extras);
+ }
+
@Override
protected void onAttachedToWindow() {
mProvider.onAttachedToWindow_impl();
import android.media.AudioAttributes;
import android.media.MediaPlayerBase;
import android.media.session.MediaController;
+import android.media.session.PlaybackState;
import android.net.Uri;
import android.widget.MediaControlView2;
import android.widget.VideoView2;
void setVideoURI_impl(Uri uri, Map<String, String> headers);
void setViewType_impl(int viewType);
int getViewType_impl();
+ void setCustomActions_impl(List<PlaybackState.CustomAction> actionList,
+ VideoView2.OnCustomActionListener listener);
void setOnPreparedListener_impl(VideoView2.OnPreparedListener l);
void setOnCompletionListener_impl(VideoView2.OnCompletionListener l);
void setOnErrorListener_impl(VideoView2.OnErrorListener l);