use of com.google.android.exoplayer2.source.hls.playlist.HlsMultivariantPlaylist in project ExoPlayer by google.
the class HlsMediaPeriodTest method getSteamKeys_isCompatibleWithHlsMultivariantPlaylistFilter.
@Test
public void getSteamKeys_isCompatibleWithHlsMultivariantPlaylistFilter() {
HlsMultivariantPlaylist testMultivariantPlaylist = createMultivariantPlaylist(/* variants= */
Arrays.asList(createAudioOnlyVariant(/* peakBitrate= */
10000), createMuxedVideoAudioVariant(/* peakBitrate= */
200000), createAudioOnlyVariant(/* peakBitrate= */
300000), createMuxedVideoAudioVariant(/* peakBitrate= */
400000), createMuxedVideoAudioVariant(/* peakBitrate= */
600000)), /* audios= */
Arrays.asList(createAudioRendition(/* language= */
"spa"), createAudioRendition(/* language= */
"ger"), createAudioRendition(/* language= */
"tur")), /* subtitles= */
Arrays.asList(createSubtitleRendition(/* language= */
"spa"), createSubtitleRendition(/* language= */
"ger"), createSubtitleRendition(/* language= */
"tur")), /* muxedAudioFormat= */
createAudioFormat("eng"), /* muxedCaptionFormats= */
Arrays.asList(createSubtitleFormat("eng"), createSubtitleFormat("gsw")));
FilterableManifestMediaPeriodFactory<HlsPlaylist> mediaPeriodFactory = (playlist, periodIndex) -> {
HlsDataSourceFactory mockDataSourceFactory = mock(HlsDataSourceFactory.class);
when(mockDataSourceFactory.createDataSource(anyInt())).thenReturn(mock(DataSource.class));
HlsPlaylistTracker mockPlaylistTracker = mock(HlsPlaylistTracker.class);
when(mockPlaylistTracker.getMultivariantPlaylist()).thenReturn((HlsMultivariantPlaylist) playlist);
MediaPeriodId mediaPeriodId = new MediaPeriodId(/* periodUid= */
new Object());
return new HlsMediaPeriod(mock(HlsExtractorFactory.class), mockPlaylistTracker, mockDataSourceFactory, mock(TransferListener.class), mock(DrmSessionManager.class), new DrmSessionEventListener.EventDispatcher().withParameters(/* windowIndex= */
0, mediaPeriodId), mock(LoadErrorHandlingPolicy.class), new MediaSourceEventListener.EventDispatcher().withParameters(/* windowIndex= */
0, mediaPeriodId, /* mediaTimeOffsetMs= */
0), mock(Allocator.class), mock(CompositeSequenceableLoaderFactory.class), /* allowChunklessPreparation= */
true, HlsMediaSource.METADATA_TYPE_ID3, /* useSessionKeys= */
false, PlayerId.UNSET);
};
MediaPeriodAsserts.assertGetStreamKeysAndManifestFilterIntegration(mediaPeriodFactory, testMultivariantPlaylist);
}
use of com.google.android.exoplayer2.source.hls.playlist.HlsMultivariantPlaylist in project ExoPlayer by google.
the class HlsMultivariantPlaylistParserTest method parseMultivariantPlaylist_withCc_cCIdPropagated.
@Test
public void parseMultivariantPlaylist_withCc_cCIdPropagated() throws IOException {
HlsMultivariantPlaylist playlist = parseMultivariantPlaylist(PLAYLIST_URI, PLAYLIST_WITH_CC);
Format firstTextFormat = playlist.muxedCaptionFormats.get(0);
assertThat(firstTextFormat.id).isEqualTo("cc1:Eng");
}
use of com.google.android.exoplayer2.source.hls.playlist.HlsMultivariantPlaylist in project ExoPlayer by google.
the class HlsMultivariantPlaylistParserTest method parseMultivariantPlaylist_withVariableSubstitution_success.
@Test
public void parseMultivariantPlaylist_withVariableSubstitution_success() throws IOException {
HlsMultivariantPlaylist playlistWithSubstitutions = parseMultivariantPlaylist(PLAYLIST_URI, PLAYLIST_WITH_VARIABLE_SUBSTITUTION);
HlsMultivariantPlaylist.Variant variant = playlistWithSubstitutions.variants.get(0);
assertThat(variant.format.codecs).isEqualTo("mp4a.40.5");
assertThat(variant.url).isEqualTo(Uri.parse("http://example.com/This/{$nested}/reference/shouldnt/work"));
}
use of com.google.android.exoplayer2.source.hls.playlist.HlsMultivariantPlaylist in project ExoPlayer by google.
the class HlsMultivariantPlaylistParserTest method parseMultivariantPlaylist_withAudio_audioIdPropagated.
@Test
public void parseMultivariantPlaylist_withAudio_audioIdPropagated() throws IOException {
HlsMultivariantPlaylist playlist = parseMultivariantPlaylist(PLAYLIST_URI, PLAYLIST_WITH_AUDIO_MEDIA_TAG);
Format firstAudioFormat = playlist.audios.get(0).format;
assertThat(firstAudioFormat.id).isEqualTo("aud1:English");
Format secondAudioFormat = playlist.audios.get(1).format;
assertThat(secondAudioFormat.id).isEqualTo("aud2:English");
}
use of com.google.android.exoplayer2.source.hls.playlist.HlsMultivariantPlaylist in project ExoPlayer by google.
the class HlsMultivariantPlaylistParserTest method parseMultivariantPlaylist_withAudio_codecPropagated.
@Test
public void parseMultivariantPlaylist_withAudio_codecPropagated() throws IOException {
HlsMultivariantPlaylist playlist = parseMultivariantPlaylist(PLAYLIST_URI, PLAYLIST_WITH_AUDIO_MEDIA_TAG);
Format firstAudioFormat = playlist.audios.get(0).format;
assertThat(firstAudioFormat.codecs).isEqualTo("mp4a.40.2");
assertThat(firstAudioFormat.sampleMimeType).isEqualTo(MimeTypes.AUDIO_AAC);
Format secondAudioFormat = playlist.audios.get(1).format;
assertThat(secondAudioFormat.codecs).isEqualTo("ac-3");
assertThat(secondAudioFormat.sampleMimeType).isEqualTo(MimeTypes.AUDIO_AC3);
}
Aggregations