mirror of
https://github.com/androidx/media.git
synced 2025-05-03 21:57:46 +08:00
Removes random ABR support in demo app
- Removed random ABR option from popup menu - Remvoed intent parameter regarding random abr, default to AdaptiveTrackSelection. Removed logic for getting track selection mode from an intent - Remvoed string definition regarding random ABR PiperOrigin-RevId: 322167816
This commit is contained in:
parent
aed5aca3dd
commit
811921e618
@ -65,12 +65,6 @@ public class IntentUtil {
|
|||||||
public static final String SPHERICAL_STEREO_MODE_TOP_BOTTOM = "top_bottom";
|
public static final String SPHERICAL_STEREO_MODE_TOP_BOTTOM = "top_bottom";
|
||||||
public static final String SPHERICAL_STEREO_MODE_LEFT_RIGHT = "left_right";
|
public static final String SPHERICAL_STEREO_MODE_LEFT_RIGHT = "left_right";
|
||||||
|
|
||||||
// Player configuration extras.
|
|
||||||
|
|
||||||
public static final String ABR_ALGORITHM_EXTRA = "abr_algorithm";
|
|
||||||
public static final String ABR_ALGORITHM_DEFAULT = "default";
|
|
||||||
public static final String ABR_ALGORITHM_RANDOM = "random";
|
|
||||||
|
|
||||||
// Media item configuration extras.
|
// Media item configuration extras.
|
||||||
|
|
||||||
public static final String URI_EXTRA = "uri";
|
public static final String URI_EXTRA = "uri";
|
||||||
|
@ -45,11 +45,8 @@ import com.google.android.exoplayer2.source.BehindLiveWindowException;
|
|||||||
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory;
|
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory;
|
||||||
import com.google.android.exoplayer2.source.TrackGroupArray;
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
import com.google.android.exoplayer2.source.ads.AdsLoader;
|
import com.google.android.exoplayer2.source.ads.AdsLoader;
|
||||||
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
|
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||||
import com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo;
|
import com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo;
|
||||||
import com.google.android.exoplayer2.trackselection.RandomTrackSelection;
|
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||||||
import com.google.android.exoplayer2.ui.DebugTextViewHelper;
|
import com.google.android.exoplayer2.ui.DebugTextViewHelper;
|
||||||
import com.google.android.exoplayer2.ui.StyledPlayerControlView;
|
import com.google.android.exoplayer2.ui.StyledPlayerControlView;
|
||||||
@ -300,24 +297,12 @@ public class PlayerActivity extends AppCompatActivity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackSelection.Factory trackSelectionFactory;
|
|
||||||
String abrAlgorithm = intent.getStringExtra(IntentUtil.ABR_ALGORITHM_EXTRA);
|
|
||||||
if (abrAlgorithm == null || IntentUtil.ABR_ALGORITHM_DEFAULT.equals(abrAlgorithm)) {
|
|
||||||
trackSelectionFactory = new AdaptiveTrackSelection.Factory();
|
|
||||||
} else if (IntentUtil.ABR_ALGORITHM_RANDOM.equals(abrAlgorithm)) {
|
|
||||||
trackSelectionFactory = new RandomTrackSelection.Factory();
|
|
||||||
} else {
|
|
||||||
showToast(R.string.error_unrecognized_abr_algorithm);
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean preferExtensionDecoders =
|
boolean preferExtensionDecoders =
|
||||||
intent.getBooleanExtra(IntentUtil.PREFER_EXTENSION_DECODERS_EXTRA, false);
|
intent.getBooleanExtra(IntentUtil.PREFER_EXTENSION_DECODERS_EXTRA, false);
|
||||||
RenderersFactory renderersFactory =
|
RenderersFactory renderersFactory =
|
||||||
DemoUtil.buildRenderersFactory(/* context= */ this, preferExtensionDecoders);
|
DemoUtil.buildRenderersFactory(/* context= */ this, preferExtensionDecoders);
|
||||||
|
|
||||||
trackSelector = new DefaultTrackSelector(/* context= */ this, trackSelectionFactory);
|
trackSelector = new DefaultTrackSelector(/* context= */ this);
|
||||||
trackSelector.setParameters(trackSelectorParameters);
|
trackSelector.setParameters(trackSelectorParameters);
|
||||||
lastSeenTrackGroupArray = null;
|
lastSeenTrackGroupArray = null;
|
||||||
|
|
||||||
|
@ -79,7 +79,6 @@ public class SampleChooserActivity extends AppCompatActivity
|
|||||||
private DownloadTracker downloadTracker;
|
private DownloadTracker downloadTracker;
|
||||||
private SampleAdapter sampleAdapter;
|
private SampleAdapter sampleAdapter;
|
||||||
private MenuItem preferExtensionDecodersMenuItem;
|
private MenuItem preferExtensionDecodersMenuItem;
|
||||||
private MenuItem randomAbrMenuItem;
|
|
||||||
private ExpandableListView sampleListView;
|
private ExpandableListView sampleListView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -135,7 +134,6 @@ public class SampleChooserActivity extends AppCompatActivity
|
|||||||
inflater.inflate(R.menu.sample_chooser_menu, menu);
|
inflater.inflate(R.menu.sample_chooser_menu, menu);
|
||||||
preferExtensionDecodersMenuItem = menu.findItem(R.id.prefer_extension_decoders);
|
preferExtensionDecodersMenuItem = menu.findItem(R.id.prefer_extension_decoders);
|
||||||
preferExtensionDecodersMenuItem.setVisible(useExtensionRenderers);
|
preferExtensionDecodersMenuItem.setVisible(useExtensionRenderers);
|
||||||
randomAbrMenuItem = menu.findItem(R.id.random_abr);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,11 +227,6 @@ public class SampleChooserActivity extends AppCompatActivity
|
|||||||
intent.putExtra(
|
intent.putExtra(
|
||||||
IntentUtil.PREFER_EXTENSION_DECODERS_EXTRA,
|
IntentUtil.PREFER_EXTENSION_DECODERS_EXTRA,
|
||||||
isNonNullAndChecked(preferExtensionDecodersMenuItem));
|
isNonNullAndChecked(preferExtensionDecodersMenuItem));
|
||||||
String abrAlgorithm =
|
|
||||||
isNonNullAndChecked(randomAbrMenuItem)
|
|
||||||
? IntentUtil.ABR_ALGORITHM_RANDOM
|
|
||||||
: IntentUtil.ABR_ALGORITHM_DEFAULT;
|
|
||||||
intent.putExtra(IntentUtil.ABR_ALGORITHM_EXTRA, abrAlgorithm);
|
|
||||||
IntentUtil.addToIntent(playlistHolder.mediaItems, intent);
|
IntentUtil.addToIntent(playlistHolder.mediaItems, intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,8 +19,4 @@
|
|||||||
android:title="@string/prefer_extension_decoders"
|
android:title="@string/prefer_extension_decoders"
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
<item android:id="@+id/random_abr"
|
|
||||||
android:title="@string/random_abr"
|
|
||||||
android:checkable="true"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -67,6 +67,4 @@
|
|||||||
|
|
||||||
<string name="prefer_extension_decoders">Prefer extension decoders</string>
|
<string name="prefer_extension_decoders">Prefer extension decoders</string>
|
||||||
|
|
||||||
<string name="random_abr">Enable random ABR</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user