Search in sources :

Example 51 with DefaultMediaSourceFactory

use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.

the class DefaultMediaSourceFactoryTest method createMediaSource_withPath_hlsSource.

@Test
public void createMediaSource_withPath_hlsSource() {
    DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
    MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA + "/file.m3u8").build();
    MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
    assertThat(mediaSource).isInstanceOf(HlsMediaSource.class);
}
Also used : MediaSource(com.google.android.exoplayer2.source.MediaSource) DefaultMediaSourceFactory(com.google.android.exoplayer2.source.DefaultMediaSourceFactory) MediaItem(com.google.android.exoplayer2.MediaItem) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)47 DefaultMediaSourceFactory (com.google.android.exoplayer2.source.DefaultMediaSourceFactory)36 MediaItem (com.google.android.exoplayer2.MediaItem)33 AdsMediaSource (com.google.android.exoplayer2.source.ads.AdsMediaSource)27 FakeMediaSource (com.google.android.exoplayer2.testutil.FakeMediaSource)16 Context (android.content.Context)15 MediaSource (com.google.android.exoplayer2.source.MediaSource)15 AdPlaybackState (com.google.android.exoplayer2.source.ads.AdPlaybackState)7 SurfaceTexture (android.graphics.SurfaceTexture)5 Surface (android.view.Surface)5 ApplicationProvider (androidx.test.core.app.ApplicationProvider)5 AndroidJUnit4 (androidx.test.ext.junit.runners.AndroidJUnit4)5 ExoPlayer (com.google.android.exoplayer2.ExoPlayer)5 PlaybackOutput (com.google.android.exoplayer2.robolectric.PlaybackOutput)5 CapturingRenderersFactory (com.google.android.exoplayer2.testutil.CapturingRenderersFactory)5 FakeClock (com.google.android.exoplayer2.testutil.FakeClock)5 Truth.assertThat (com.google.common.truth.Truth.assertThat)5 RunWith (org.junit.runner.RunWith)5 Pair (android.util.Pair)4 Player (com.google.android.exoplayer2.Player)4