MediaPlayer Url issue Only on Android 6.0.1

99 views Asked by At

After Calling the below method The app appears to be stuck on the loading screen and stop responding ,I'm performing my tests on a WiFi network so the connection should not be the issue. Testing with Android M 6.0.0 works fine, this only occurs for 6.0.1. Quite annoying, has anybody a hint


   fun getMusic() {
        mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC)
        mediaPlayer.setDataSource(url)
        mediaPlayer.prepare()
        mediaPlayer.start()
      }

My url :http://www.islamicaudio.org/wp-content/uploads/2018/10/2016-07-23-தெளிவு-6-தொழுகையில்-கழா-இருக்கிறதா-islam-in-tamil-mubarak-madani.mp3

this is the Error

   java.lang.IllegalStateException
    at android.media.MediaPlayer.nativeSetDataSource(Native Method)
    at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1080)
    at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1041)
    at com.codenex.getbug.MainActivity.getMusic(MainActivity.kt:79)
    at com.codenex.getbug.MainActivity$onCreate$1.onClick(MainActivity.kt:55)
0

There are 0 answers