Search in sources :

Example 1 with MultiSegmentRepresentation

use of com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation in project ExoPlayer by google.

the class DashManifestParserTest method parseMediaPresentationDescription_segmentTemplate.

@Test
public void parseMediaPresentationDescription_segmentTemplate() throws IOException {
    DashManifestParser parser = new DashManifestParser();
    DashManifest manifest = parser.parse(Uri.parse("https://example.com/test.mpd"), TestUtil.getInputStream(ApplicationProvider.getApplicationContext(), SAMPLE_MPD_SEGMENT_TEMPLATE));
    assertThat(manifest.getPeriodCount()).isEqualTo(1);
    Period period = manifest.getPeriod(0);
    assertThat(period).isNotNull();
    assertThat(period.adaptationSets).hasSize(2);
    for (AdaptationSet adaptationSet : period.adaptationSets) {
        assertThat(adaptationSet).isNotNull();
        for (Representation representation : adaptationSet.representations) {
            if (representation instanceof Representation.MultiSegmentRepresentation) {
                Representation.MultiSegmentRepresentation multiSegmentRepresentation = (Representation.MultiSegmentRepresentation) representation;
                long firstSegmentIndex = multiSegmentRepresentation.getFirstSegmentNum();
                RangedUri uri = multiSegmentRepresentation.getSegmentUrl(firstSegmentIndex);
                assertThat(uri.resolveUriString(representation.baseUrls.get(0).url)).contains("redirector.googlevideo.com");
            }
        }
    }
}
Also used : SingleSegmentRepresentation(com.google.android.exoplayer2.source.dash.manifest.Representation.SingleSegmentRepresentation) MultiSegmentRepresentation(com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation) MultiSegmentRepresentation(com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation) MultiSegmentRepresentation(com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation) Test(org.junit.Test)

Aggregations

MultiSegmentRepresentation (com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation)1 SingleSegmentRepresentation (com.google.android.exoplayer2.source.dash.manifest.Representation.SingleSegmentRepresentation)1 Test (org.junit.Test)1