Below is the code to How I initialize the Exoplayer.
private void initializePlayer(String path) {
player = ExoPlayerFactory.newSimpleInstance(mContext, trackSelector);
player.addListener(componentListener);
Uri uri = Uri.parse(path);
MediaSource mediaSource = buildMediaSource(uri);
player.prepare(mediaSource, true, false);
playerView.setPlayer(player);
}
Initialize the player and pass the url to it to play the any type of video in exoplayer:
and build media source function is:
Also call the initPlayer() in your activity oncreate function