Marian Pavel Marian Pavel - 3 years ago 123
Android Question

Android stream over ExoPlayer

I am trying to switch from

MediaPlayer
in favor of
ExoPlayer
but I can't find any updated demo how can I use it.I think they have removed the
FrameworkSampleSource
method. I downloaded the demo from github but I can't find the implementation of player, I could find the Samples object where the url's are added.
I have a list of URL's that I want to be played.I am switching to exoPlayer because it's smoother than MediaPlayer.I have readed all StackOverflow topics about exoPlayer but none of them are updated.

Can anyone give me an example how can implement it ? Thank you.

Answer Source
    FrameworkSampleSource source = new FrameworkSampleSource(App.getContext(), track.Uri, null, 1);
    TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(source, null, true);
    exoPlayer.prepare(audioRenderer);

Hope this short example will help

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download