ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Using ExoPlayer's data sources in android.media.MediaPlayer

Open aarondib opened this issue 8 years ago • 1 comments

Hi!

In standard MediaPlayer there is no option to change buffer size, so the idea is to use ExoPlayer's data source classes to be used with the android.media.MediaPlayer. It is for live streams mostly. For example, saving data to a local file or RAM and then set this file/data in mediaPlayer.setDatasource(fileDescriptior); Could you , please, advice the most suitable way for this implementation?

aarondib avatar Jun 27 '18 07:06 aarondib

This is more a question about MediaPlayer, but I'll do my best to answer anyway.

It's probably possible to wrap an ExoPlayer DataSource in an android.media.MediaDataSource and pass that to setDataSource, but this is only available from Android M. Also, this isn't going to give you control over the buffer size unless you've implemented the buffer you want to control inside the DataSource, so I'm not sure it will solve the problem.

One approach I've seen before is to start a local proxy server where you have control over loading data, then get MediaPlayer to connect to that. This has a few drawbacks though, not least that it's complicated, so I'd recommend against it if you have any other options.

andrewlewis avatar Jun 27 '18 07:06 andrewlewis