So I have to access a media file which is on the server. I have to add access token to header so I can access the file. My goal is to play the media. The usual code is like this:
//for audio
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(url);
mediaPlayer.prepare();
mediaPlayer.start();
//for video
videoView.setVideoURI(Uri.parse(url));
videoView.start();
Now consider that the url
that I'm calling needs an OAuth2
authentication, which literally means adding an access-token
to the header of the request. Is this possible by any means in Android?