Media Playback on Android with ExoPlayer: Getting Started | raywenderlich.com

In this tutorial you will learn how to use ExoPlayer to provide media playback in your Android app.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5573-media-playback-on-android-with-exoplayer-getting-started

Excellent tutorial! Thank you! How do we add our own remote URL as the data source for the videos?

@ddjermanovic Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @iknowzo, Thank you. Iโ€™m glad you like it. :]

Iโ€™m not sure what you mean by โ€œour own remote URLโ€. In the tutorial, videos are fetched from Cloudinary, and weโ€™re are explicitly creating a URL to the videos in the MainActivitys createVideoUrl method, which you can check out if you download materials for the project.
That URL is passed to the MediaPlayerImpl class which a wrapper around ExoPlayer implementation. In the play method of the MediaPlayerImpl media source is created like this:

    val mediaSource = ExtractorMediaSource.Factory(DefaultDataSourceFactory(context, userAgent))
        .setExtractorsFactory(DefaultExtractorsFactory())
        .createMediaSource(Uri.parse(url))

createMediaSource method is used for setting the URL from which videos are fetched. You can specify here any remote URL that contains video.

I hope this answers your question. :]

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!