I'm using the playlist1 source code here: http://www.glowingpigs.com/index.php/extras
All I've done is changed the setDataSource from a local .mp3 to an audio webstream and added the following to the manifest since from my understanding 4.xx needs internet permission for webstreaming:
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
Media Player Code:
if (!mediaPlayer.isPlaying()) {
try {
mediaPlayer.setDataSource("http://stream.kpsu.org:8080/listen");
// Send message to Activity to display progress dialogue
sendBufferingBroadcast();
// Prepare mediaplayer
mediaPlayer.prepareAsync();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
}
}
And getting the weird "Unable to to create media player" error. Weird, because it really has two to's and weird because it fails to build on the data source even though the data source is correct
Issue was
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
was that instead of
<uses-permission android:name="android.permission.INTERNET"/>
I had put the internet permission in the manifest, but somehow or another it got erased. And I ended up pasting absentmindedly something here I should have seen was not the INTERNET permission and recognized that the INTERNET permission was missing and was causing the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With