0

I have a content of dash mpd file on string variable

String MPDString = "<?xml version="1.0"?>
" +
            "<!-- MPD file Generated with GPAC version 0.5.2-DEV-revVersion: 0.5.2-426-gc5ad4e4+dfsg5-1build1  at 2018-03-07T11:10:44.851Z-->\n" +
            ...........
            </MPD>
            ";

I want to use this string as dashsource but confused I looked the link : Create MPD file from String But still confused Can anyone please provide me some more information

Sanjiv Dhakal
  • 316
  • 3
  • 13

1 Answers1

0

If you look at the answer you linked to in your question you will see the last example is creating the manifest from a string named 'manifestString'.

DataSource.Factory manifestDataSourceFactory = new DataSource.Factory() {
    @Override
    public DataSource createDataSource() {
        return new ByteArrayDataSource(manifestString.getBytes());
    }
};

Assunming your 'MPDString' in your example is a correctly formatted mod then you simply use it above in place of 'manifestString':

DataSource.Factory manifestDataSourceFactory = new DataSource.Factory() {
    @Override
    public DataSource createDataSource() {
        return new ByteArrayDataSource(MPDString.getBytes());
    }
};
Mick
  • 24,231
  • 1
  • 54
  • 120
  • I have done as per the example, but while preparing exoplayer, i need a dashmediasource, and to create the dashmediasource, i need manifest uri as it is notnullable, exoPlayer.prepare(dashMediaSourceFactory.createMediaSource(????)); – Sanjiv Dhakal Apr 04 '18 at 07:22