Android Mediaplayer errors after upgrading to 5.0
I just recently updated my Galaxy s5 to 5.0 from 4.4.4 and my code for my media player is broken. Everything works fine until update, this also happens on my Nexus 7 tablet. I am getting the url from the server and trying to stream mp3 from the server. This code below is executed inside asynctask in the onpostexecute method.
try
{
if (mediaPlayer == null)
{
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(sUrl);
mediaPlayer.setOnPreparedListener(this);
mediaPlayer.prepareAsync();
}
}
catch (IOException e)
{
e.printStackTrace();
}
@Override
public void onPrepared(MediaPlayer mp)
{
mp.start();
}
Here is my log
04-26 21:44:19.021 4660-4671/com.reach.sledgehammerlabs.reach D/MediaHTTPConnection﹕ filterOutInternalHeaders: key=User-Agent, val= Samsung SAMSUNG-SM-G900A stagefright/Beyonce/1.1.9 (Linux;Android 5.0)
04-26 21:44:19.021 4660-4725/com.reach.sledgehammerlabs.reach D/MediaHTTPConnection﹕ setReadTimeout with 30000ms
04-26 21:44:19.021 4660-4725/com.reach.sledgehammerlabs.reach I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-26 21:44:19.031 4660-4725/com.reach.sledgehammerlabs.reach I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
04-26 21:44:19.171 4660-4674/com.reach.sledgehammerlabs.reach D/MediaHTTPConnection﹕ setReadTimeout with 30000ms
04-26 21:44:19.171 4660-4674/com.reach.sledgehammerlabs.reach I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-26 21:44:19.181 4660-4674/com.reach.sledgehammerlabs.reach I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
04-26 21:44:19.351 4660-4725/com.reach.sledgehammerlabs.reach V/MediaPlayer﹕ message received msg=100, ext1=1, ext2=-2147483648
04-26 21:44:19.351 4660-4725/com.reach.sledgehammerlabs.reach E/MediaPlayer﹕ error (1, -2147483648)
04-26 21:44:19.351 4660-4725/com.reach.sledgehammerlabs.reach V/MediaPlayer﹕ callback application
04-26 21:44:19.351 4660-4725/com.reach.sledgehammerlabs.reach V/MediaPlayer﹕ back from callback
04-26 21:44:19.351 4660-4660/com.reach.sledgehammerlabs.reach E/MediaPlayer﹕ Error (1,-2147483648)
+2
source to share
3 answers
The reason it didn't always work was because some of the URLs had spaces in them and they weren't being processed correctly.
http: // a space vs http: // a% space
0
source to share
we faced the same issue in Galaxy s4 with update 5.0, after we tried many solutions, we finally changed the url protocol from http to rtsp (for example http: // some / file / url "from" rtsp: / / some / file / url ") and it solved the problem
0
source to share