use of androidx.media3.exoplayer.dash.DashMediaSource in project media by androidx.
the class DashMediaSource method prepareSourceInternal.
@Override
protected void prepareSourceInternal(@Nullable TransferListener mediaTransferListener) {
this.mediaTransferListener = mediaTransferListener;
drmSessionManager.prepare();
drmSessionManager.setPlayer(/* playbackLooper= */
Looper.myLooper(), getPlayerId());
if (sideloadedManifest) {
processManifest(false);
} else {
dataSource = manifestDataSourceFactory.createDataSource();
loader = new Loader("DashMediaSource");
handler = Util.createHandlerForCurrentLooper();
startLoadingManifest();
}
}
use of androidx.media3.exoplayer.dash.DashMediaSource in project media by androidx.
the class DashMediaSourceTest method prepare_withCompleteServiceDescription_usesManifestValue.
@Test
public void prepare_withCompleteServiceDescription_usesManifestValue() throws InterruptedException {
DashMediaSource mediaSource = new DashMediaSource.Factory(() -> createSampleMpdDataSource(SAMPLE_MPD_LIVE_WITH_COMPLETE_SERVICE_DESCRIPTION)).setFallbackTargetLiveOffsetMs(1234L).createMediaSource(MediaItem.fromUri(Uri.EMPTY));
MediaItem.LiveConfiguration liveConfiguration = prepareAndWaitForTimelineRefresh(mediaSource).liveConfiguration;
assertThat(liveConfiguration.targetOffsetMs).isEqualTo(4_000L);
assertThat(liveConfiguration.minOffsetMs).isEqualTo(2_000L);
assertThat(liveConfiguration.maxOffsetMs).isEqualTo(6_000L);
assertThat(liveConfiguration.minPlaybackSpeed).isEqualTo(0.96f);
assertThat(liveConfiguration.maxPlaybackSpeed).isEqualTo(1.04f);
}
use of androidx.media3.exoplayer.dash.DashMediaSource in project media by androidx.
the class DashMediaSourceTest method prepare_withoutLiveConfiguration_withOnlyMediaItemTargetOffset_usesUnitSpeed.
@Test
public void prepare_withoutLiveConfiguration_withOnlyMediaItemTargetOffset_usesUnitSpeed() throws InterruptedException {
DashMediaSource mediaSource = new DashMediaSource.Factory(() -> createSampleMpdDataSource(SAMPLE_MPD_LIVE_WITHOUT_LIVE_CONFIGURATION)).createMediaSource(new MediaItem.Builder().setUri(Uri.EMPTY).setLiveConfiguration(new LiveConfiguration.Builder().setTargetOffsetMs(10_000L).build()).build());
MediaItem.LiveConfiguration liveConfiguration = prepareAndWaitForTimelineRefresh(mediaSource).liveConfiguration;
assertThat(liveConfiguration.targetOffsetMs).isEqualTo(10_000L);
assertThat(liveConfiguration.minOffsetMs).isEqualTo(0L);
assertThat(liveConfiguration.maxOffsetMs).isEqualTo(58_000L);
assertThat(liveConfiguration.minPlaybackSpeed).isEqualTo(1f);
assertThat(liveConfiguration.maxPlaybackSpeed).isEqualTo(1f);
}
use of androidx.media3.exoplayer.dash.DashMediaSource in project media by androidx.
the class DashMediaSourceTest method replaceManifestUri_doesNotChangeMediaItem.
@Test
public void replaceManifestUri_doesNotChangeMediaItem() {
DashMediaSource.Factory factory = new DashMediaSource.Factory(new FileDataSource.Factory());
MediaItem mediaItem = MediaItem.fromUri("http://www.google.com");
DashMediaSource mediaSource = factory.createMediaSource(mediaItem);
mediaSource.replaceManifestUri(Uri.EMPTY);
assertThat(mediaSource.getMediaItem()).isEqualTo(mediaItem);
}
use of androidx.media3.exoplayer.dash.DashMediaSource in project media by androidx.
the class DashMediaSourceTest method prepare_targetLiveOffsetInWindow_manifestTargetOffsetAndAlignedWindowStartPosition.
@Test
public void prepare_targetLiveOffsetInWindow_manifestTargetOffsetAndAlignedWindowStartPosition() throws InterruptedException {
DashMediaSource mediaSource = new DashMediaSource.Factory(() -> createSampleMpdDataSource(SAMPLE_MPD_LIVE_WITH_OFFSET_INSIDE_WINDOW)).createMediaSource(MediaItem.fromUri(Uri.EMPTY));
Window window = prepareAndWaitForTimelineRefresh(mediaSource);
// Expect the target live offset as defined in the manifest.
assertThat(window.liveConfiguration.targetOffsetMs).isEqualTo(3000);
// Expect the default position at the first segment start before the live edge.
assertThat(window.getDefaultPositionMs()).isEqualTo(2_000);
}
Aggregations