From 7c3fe15426e8150c92ee7589acf011872b0beb07 Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 5 Oct 2016 02:40:52 -0700 Subject: [PATCH] Add convenience getPlayer methods to UI components Issue: #1895 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=135211179 --- .../google/android/exoplayer2/ui/PlaybackControlView.java | 7 +++++++ .../google/android/exoplayer2/ui/SimpleExoPlayerView.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java b/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java index 7f351afe8b..f6d8742fa5 100644 --- a/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java +++ b/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java @@ -127,6 +127,13 @@ public class PlaybackControlView extends FrameLayout { updateAll(); } + /** + * Returns the player currently being controlled by this view, or null if no player is set. + */ + public ExoPlayer getPlayer() { + return player; + } + /** * Sets the {@link ExoPlayer} to control. * diff --git a/library/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java b/library/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java index 9263918958..1aeed503ac 100644 --- a/library/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java +++ b/library/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java @@ -93,6 +93,13 @@ public final class SimpleExoPlayerView extends FrameLayout { layout.addView(surfaceView, 0); } + /** + * Returns the player currently set on this view, or null if no player is set. + */ + public SimpleExoPlayer getPlayer() { + return player; + } + /** * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous