Search in sources :

Example 1 with InvalidationListener

use of androidx.media3.exoplayer.trackselection.TrackSelector.InvalidationListener in project media by androidx.

the class DefaultTrackSelectorTest method setParameterWithNonDefaultParameterNotifyInvalidationListener.

/**
 * Tests that track selector will call {@link InvalidationListener#onTrackSelectionsInvalidated()}
 * when it's set with non-default values of {@link Parameters}.
 */
@Test
public void setParameterWithNonDefaultParameterNotifyInvalidationListener() {
    ParametersBuilder builder = defaultParameters.buildUpon().setPreferredAudioLanguage("eng");
    trackSelector.setParameters(builder);
    verify(invalidationListener).onTrackSelectionsInvalidated();
}
Also used : ParametersBuilder(androidx.media3.exoplayer.trackselection.DefaultTrackSelector.ParametersBuilder) Test(org.junit.Test)

Example 2 with InvalidationListener

use of androidx.media3.exoplayer.trackselection.TrackSelector.InvalidationListener in project media by androidx.

the class DefaultTrackSelectorTest method setParameterWithSameParametersDoesNotNotifyInvalidationListenerAgain.

/**
 * Tests that track selector will not call {@link
 * InvalidationListener#onTrackSelectionsInvalidated()} again when it's set with the same values
 * of {@link Parameters}.
 */
@Test
public void setParameterWithSameParametersDoesNotNotifyInvalidationListenerAgain() {
    ParametersBuilder builder = defaultParameters.buildUpon().setPreferredAudioLanguage("eng");
    trackSelector.setParameters(builder);
    trackSelector.setParameters(builder);
    verify(invalidationListener, times(1)).onTrackSelectionsInvalidated();
}
Also used : ParametersBuilder(androidx.media3.exoplayer.trackselection.DefaultTrackSelector.ParametersBuilder) Test(org.junit.Test)

Example 3 with InvalidationListener

use of androidx.media3.exoplayer.trackselection.TrackSelector.InvalidationListener in project media by androidx.

the class TrackSelectorTest method getBandwidthMeter_afterInitialization_returnsProvidedBandwidthMeter.

@Test
public void getBandwidthMeter_afterInitialization_returnsProvidedBandwidthMeter() {
    InvalidationListener invalidationListener = Mockito.mock(InvalidationListener.class);
    BandwidthMeter bandwidthMeter = Mockito.mock(BandwidthMeter.class);
    trackSelector.init(invalidationListener, bandwidthMeter);
    assertThat(trackSelector.getBandwidthMeter()).isEqualTo(bandwidthMeter);
}
Also used : BandwidthMeter(androidx.media3.exoplayer.upstream.BandwidthMeter) InvalidationListener(androidx.media3.exoplayer.trackselection.TrackSelector.InvalidationListener) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 ParametersBuilder (androidx.media3.exoplayer.trackselection.DefaultTrackSelector.ParametersBuilder)2 InvalidationListener (androidx.media3.exoplayer.trackselection.TrackSelector.InvalidationListener)1 BandwidthMeter (androidx.media3.exoplayer.upstream.BandwidthMeter)1