From 80e9c84a9ef9d13fdc3990f4b87b4424e2e0b877 Mon Sep 17 00:00:00 2001 From: aquilescanta Date: Thu, 18 Oct 2018 08:56:36 -0700 Subject: [PATCH] Remove RemotePlayer ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=217708323 --- .../DefaultReceiverPlayerManager.java | 4 +- .../exoplayer2/ext/cast/CastPlayer.java | 10 ++--- .../exoplayer2/ext/cast/RemotePlayer.java | 45 ------------------- .../ext/cast/SessionAvailabilityListener.java | 26 +++++++++++ 4 files changed, 33 insertions(+), 52 deletions(-) delete mode 100644 extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/RemotePlayer.java create mode 100644 extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/SessionAvailabilityListener.java diff --git a/demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/DefaultReceiverPlayerManager.java b/demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/DefaultReceiverPlayerManager.java index f30d3e602f..daaac9486e 100644 --- a/demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/DefaultReceiverPlayerManager.java +++ b/demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/DefaultReceiverPlayerManager.java @@ -33,7 +33,7 @@ import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Timeline.Period; import com.google.android.exoplayer2.ext.cast.CastPlayer; import com.google.android.exoplayer2.ext.cast.MediaItem; -import com.google.android.exoplayer2.ext.cast.RemotePlayer; +import com.google.android.exoplayer2.ext.cast.SessionAvailabilityListener; import com.google.android.exoplayer2.source.ConcatenatingMediaSource; import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.MediaSource; @@ -52,7 +52,7 @@ import java.util.ArrayList; /** Manages players and an internal media queue for the ExoPlayer/Cast demo app. */ /* package */ class DefaultReceiverPlayerManager - implements EventListener, RemotePlayer.SessionAvailabilityListener, PlayerManager { + implements EventListener, SessionAvailabilityListener, PlayerManager { private static final String USER_AGENT = "ExoCastDemoPlayer"; private static final DefaultHttpDataSourceFactory DATA_SOURCE_FACTORY = diff --git a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java index e5832f3b31..584ac68305 100644 --- a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java +++ b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java @@ -53,8 +53,8 @@ import java.util.concurrent.CopyOnWriteArraySet; * *

The behavior of this class depends on the underlying Cast session, which is obtained from the * Cast context passed to {@link #CastPlayer}. To keep track of the session, {@link - * #isCastSessionAvailable()} can be queried and {@link RemotePlayer.SessionAvailabilityListener} - * can be implemented and attached to the player. + * #isCastSessionAvailable()} can be queried and {@link SessionAvailabilityListener} can be + * implemented and attached to the player. * *

If no session is available, the player state will remain unchanged and calls to methods that * alter it will be ignored. Querying the player state is possible even when no session is @@ -88,7 +88,7 @@ public final class CastPlayer extends BasePlayer { // Listeners. private final CopyOnWriteArraySet listeners; - private RemotePlayer.SessionAvailabilityListener sessionAvailabilityListener; + private SessionAvailabilityListener sessionAvailabilityListener; // Internal state. private CastTimeline currentTimeline; @@ -257,9 +257,9 @@ public final class CastPlayer extends BasePlayer { /** * Sets a listener for updates on the cast session availability. * - * @param listener The {@link RemotePlayer.SessionAvailabilityListener}. + * @param listener The {@link SessionAvailabilityListener}. */ - public void setSessionAvailabilityListener(RemotePlayer.SessionAvailabilityListener listener) { + public void setSessionAvailabilityListener(SessionAvailabilityListener listener) { sessionAvailabilityListener = listener; } diff --git a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/RemotePlayer.java b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/RemotePlayer.java deleted file mode 100644 index 98d5895db8..0000000000 --- a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/RemotePlayer.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.android.exoplayer2.ext.cast; - -import com.google.android.exoplayer2.Player; - -/** A {@link Player} for playing media remotely using the Google Cast framework. */ -public interface RemotePlayer extends Player { - - /** Listener of changes in the cast session availability. */ - interface SessionAvailabilityListener { - - /** Called when a cast session becomes available to the player. */ - void onCastSessionAvailable(); - - /** Called when the cast session becomes unavailable. */ - void onCastSessionUnavailable(); - } - - /** Returns whether a cast session is available. */ - boolean isCastSessionAvailable(); - - /** - * Sets a listener for updates on the cast session availability. - * - * @param listener The {@link SessionAvailabilityListener}. - */ - void setSessionAvailabilityListener(SessionAvailabilityListener listener); - - /** Returns the {@link MediaItemQueue} associated to this player. */ - MediaItemQueue getMediaItemQueue(); -} diff --git a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/SessionAvailabilityListener.java b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/SessionAvailabilityListener.java new file mode 100644 index 0000000000..c686c496c6 --- /dev/null +++ b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/SessionAvailabilityListener.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.android.exoplayer2.ext.cast; + +/** Listener of changes in the cast session availability. */ +public interface SessionAvailabilityListener { + + /** Called when a cast session becomes available to the player. */ + void onCastSessionAvailable(); + + /** Called when the cast session becomes unavailable. */ + void onCastSessionUnavailable(); +}