I've managed to create a MPD file that is perfectly playable when fed to ExoPlayer 2.6.0 via an URL (the MPD is hosted in a testing server).
However, I need to create this MPD file in Android and feed it to ExoPlayer without requesting the file to the server. So far I've tried to understand the classes DashManifest & DashManifestParser with no success. Any ideas how to create the file in Android and feed it directly to ExoPlayer?
When playing an DASH stream you need to create a DashMediaSource.Factory. The first parameter is the DashChunkSource which reads the media files defined by your manifest. The second parameter is the DataSource.Factory to read the manifest.
So you need to provide a DataSource.Factory which creates a DataSource to read your manifest. See the
manifestDataSourceFactory
in the snippet below:a) Static mpd on local disk
If your manifest is stored as a local file you can use a DefaultDataSourceFactory and pass the file path as the
manifestUri
:b) in-memory manifest
If your manifest is in memory you can provide a ByteArrayDataSource with a custom DataSource.Factory: