Search in sources :

Example 1 with MultiSegmentRepresentation

use of androidx.media3.exoplayer.dash.manifest.Representation.MultiSegmentRepresentation in project media by androidx.

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 : MultiSegmentRepresentation(androidx.media3.exoplayer.dash.manifest.Representation.MultiSegmentRepresentation) SingleSegmentRepresentation(androidx.media3.exoplayer.dash.manifest.Representation.SingleSegmentRepresentation) MultiSegmentRepresentation(androidx.media3.exoplayer.dash.manifest.Representation.MultiSegmentRepresentation) MultiSegmentRepresentation(androidx.media3.exoplayer.dash.manifest.Representation.MultiSegmentRepresentation) Test(org.junit.Test)

Aggregations

MultiSegmentRepresentation (androidx.media3.exoplayer.dash.manifest.Representation.MultiSegmentRepresentation)1 SingleSegmentRepresentation (androidx.media3.exoplayer.dash.manifest.Representation.SingleSegmentRepresentation)1 Test (org.junit.Test)1