Domanda

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

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top