Commit a263fb16 by aquilescanta Committed by Andrew Lewis

Remove default-receiver-related classes from Cast demo app

PiperOrigin-RevId: 233073011
parent 6f1daff3
......@@ -48,22 +48,6 @@ android {
// The demo app does not have translations.
disable 'MissingTranslation'
}
flavorDimensions "receiver"
productFlavors {
exoCast {
dimension "receiver"
manifestPlaceholders =
[castOptionsProvider: "com.google.android.exoplayer2.ext.cast.ExoCastOptionsProvider"]
}
defaultCast {
dimension "receiver"
manifestPlaceholders =
[castOptionsProvider: "com.google.android.exoplayer2.ext.cast.DefaultCastOptionsProvider"]
}
}
}
dependencies {
......
......@@ -23,7 +23,7 @@
android:largeHeap="true" android:allowBackup="false">
<meta-data android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="${castOptionsProvider}" />
android:value="com.google.android.exoplayer2.ext.cast.ExoCastOptionsProvider" />
<activity android:name="com.google.android.exoplayer2.castdemo.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
......
......@@ -38,7 +38,6 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ext.cast.MediaItem;
import com.google.android.exoplayer2.ui.PlayerControlView;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.gms.cast.CastMediaControlIntent;
import com.google.android.gms.cast.framework.CastButtonFactory;
import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.dynamite.DynamiteModule;
......@@ -49,13 +48,13 @@ import java.util.Collections;
* Cast extension.
*/
public class MainActivity extends AppCompatActivity
implements OnClickListener, PlayerManager.QueueChangesListener {
implements OnClickListener, ExoCastPlayerManager.QueueChangesListener {
private final MediaItem.Builder mediaItemBuilder;
private PlayerView localPlayerView;
private PlayerControlView castControlView;
private PlayerManager playerManager;
private ExoCastPlayerManager playerManager;
private RecyclerView mediaQueueList;
private MediaQueueListAdapter mediaQueueListAdapter;
private CastContext castContext;
......@@ -117,29 +116,13 @@ public class MainActivity extends AppCompatActivity
// There is no Cast context to work with. Do nothing.
return;
}
String applicationId = castContext.getCastOptions().getReceiverApplicationId();
switch (applicationId) {
case CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID:
playerManager =
new DefaultReceiverPlayerManager(
/* queueChangesListener= */ this,
localPlayerView,
castControlView,
/* context= */ this,
castContext);
break;
case ExoCastOptionsProvider.RECEIVER_ID:
playerManager =
new ExoCastPlayerManager(
/* queueChangesListener= */ this,
localPlayerView,
castControlView,
/* context= */ this,
castContext);
break;
default:
throw new IllegalStateException("Illegal receiver app id: " + applicationId);
}
playerManager =
new ExoCastPlayerManager(
/* queueChangesListener= */ this,
localPlayerView,
castControlView,
/* context= */ this,
castContext);
mediaQueueList.setAdapter(mediaQueueListAdapter);
}
......
/*
* 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.castdemo;
import android.view.KeyEvent;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ext.cast.MediaItem;
/** Manages the players in the Cast demo app. */
interface PlayerManager {
/** Listener for changes in the media queue. */
interface QueueChangesListener {
/** Called when the currently played item of the media queue changes. */
void onQueuePositionChanged(int previousIndex, int newIndex);
/** Called when the media queue changes due to modifications not caused by this manager. */
void onQueueContentsExternallyChanged();
}
/** Redirects the given {@code keyEvent} to the active player. */
boolean dispatchKeyEvent(KeyEvent keyEvent);
/** Appends the given {@link MediaItem} to the media queue. */
void addItem(MediaItem mediaItem);
/** Returns the number of items in the media queue. */
int getMediaQueueSize();
/** Selects the item at the given position for playback. */
void selectQueueItem(int position);
/**
* Returns the position of the item currently being played, or {@link C#INDEX_UNSET} if no item is
* being played.
*/
int getCurrentItemIndex();
/** Returns the {@link MediaItem} at the given {@code position}. */
MediaItem getItem(int position);
/** Moves the item at position {@code from} to position {@code to}. */
boolean moveItem(int from, int to);
/** Removes the item at position {@code index}. */
boolean removeItem(int index);
/** Releases any acquired resources. */
void release();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment