I am trying to play music from URL with Media Player but getting error in playing it

```
        final MediaPlayer mp = new MediaPlayer();
    try {

        mp.setDataSource(url[0]);
        mp.prepare();
        mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                mp.start();
            }
        });
    } catch(Exception e){
        System.out.println(e);
    }

```

i have also tried to use with URI

```
        Uri uri = Uri.parse(url[0]);
        mp.setDataSource(context,uri);
        mp.prepare();

```

And also tried using mp.prepareAsync(); method

But then also getting this type of error and media not playing

```
W/MediaPlayer: Couldn't open 
java.io.FileNotFoundException: No content provider: 
    at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1675)
    at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1505)
    at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1422)
    at android.media.MediaPlayer.attemptDataSource(MediaPlayer.java:1101)
    at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1073)
    at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1001)
    at com.tuwy.Dailog.DialogClass.showAudioDialog(DialogClass.java:272)

```

and getting this also

```
W/AudioTrack: Use of stream types is deprecated for operations other than volume control
See the documentation of AudioTrack() for what to use instead with android.media.AudioAttributes to qualify your playback use case
V/AudioTrack: pause(2131): prior state:STATE_ACTIVE
I/System.out: java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory)

```