MediaPlayer Audio Streaming Fails on Galaxy Tab

I have a problem playing streaming audio * on the Galaxy Tab tab (works on HTC Desire HD and Nexus One). When I create a MediaPlayer object, it throws this error:

02-09 02:21:39.088: VERBOSE/MediaPlayer-JNI(9325): native_setup
02-09 02:21:39.088: VERBOSE/MediaPlayer(9325): constructor
02-09 02:21:39.088: VERBOSE/MediaPlayer(9325): setListener
02-09 02:21:39.092: INFO/MediaPlayer(9325): uri is:http://147.83.39.86:3200/osgi/files/TTS/1297185775715.ogg
02-09 02:21:39.092: INFO/MediaPlayer(9325): path is null
02-09 02:21:39.092: DEBUG/MediaPlayer(9325): Couldn't open file on client side, trying server side
02-09 02:21:39.092: VERBOSE/MediaPlayer-JNI(9325): setDataSource: path http://147.83.39.86:3200/osgi/files/TTS/1297185775715.ogg
02-09 02:21:39.092: VERBOSE/MediaPlayer(9325): setDataSource(http://147.83.39.86:3200/osgi/files/TTS/1297185775715.ogg)
02-09 02:21:39.092: ERROR/MediaPlayerService(2392): Failed to create player object
02-09 02:21:39.092: ERROR/MediaPlayer(9325): Unable to to create media player
02-09 02:21:39.104: DEBUG/MediaPlayer(9325): create failed:
02-09 02:21:39.104: DEBUG/MediaPlayer(9325): java.io.IOException: setDataSource failed.: status=0x80000000
02-09 02:21:39.104: DEBUG/MediaPlayer(9325):     at android.media.MediaPlayer.setDataSource(Native Method)
02-09 02:21:39.104: DEBUG/MediaPlayer(9325):     at android.media.MediaPlayer.setDataSource(MediaPlayer.java:745)
02-09 02:21:39.104: DEBUG/MediaPlayer(9325):     at android.media.MediaPlayer.setDataSource(MediaPlayer.java:675)
02-09 02:21:39.104: DEBUG/MediaPlayer(9325):     at android.media.MediaPlayer.create(MediaPlayer.java:611)
02-09 02:21:39.104: DEBUG/MediaPlayer(9325):     at android.media.MediaPlayer.create(MediaPlayer.java:592)
02-09 02:21:39.104: DEBUG/MediaPlayer(9325):     at com.vodafone.inredis.movil.interfazweb.InredisWebViewClient.shouldOverrideUrlLoading(InredisWebViewClient.java:37)

And this is how I create the MediaPlayer object, nothing strange:

Uri tempPath = Uri.parse(url);
player = MediaPlayer.create(interfazWeb, tempPath);
if (player != null){
  player.start();
} else {
  Log.e(TAG, "No se puede abrir el audio:" + url);
}
return true;

And to provide additional information, I can say that I tested the URL and I can download it using my own browser and play it normally. Obviously, I can play it using my desktop browser.

Did any problem have this problem with the specified device?

Thanks in advance.

######## EDIT ###############

, , , MediaPlayer. , , .

, temp, , , , , .

02-10 01:36:36.945: VERBOSE/MediaPlayer-JNI(8371): native_setup
02-10 01:36:36.945: VERBOSE/MediaPlayer(8371): constructor
02-10 01:36:36.945: VERBOSE/MediaPlayer(8371): setListener
02-10 01:36:36.948: VERBOSE/MediaPlayer-JNI(8371): setDataSource: path /sdcard/audioTmp360988.ogg
02-10 01:36:36.948: VERBOSE/MediaPlayer(8371): setDataSource(/sdcard/audioTmp360988.ogg)
02-10 01:36:36.952: VERBOSE/MediaPlayer(8371): prepare
02-10 01:36:36.952: ERROR/MediaPlayerService(2394): Client::notify In
02-10 01:36:36.952: ERROR/MediaPlayer(8371): message received msg=1, ext1=0, ext2=0
02-10 01:36:36.952: VERBOSE/MediaPlayer(8371): prepared
02-10 01:36:36.952: VERBOSE/MediaPlayer(8371): signal application thread
02-10 01:36:36.952: ERROR/MediaPlayer(8371): callback application
02-10 01:36:36.952: ERROR/MediaPlayer(8371): back from callback
02-10 01:36:36.952: VERBOSE/MediaPlayer(8371): prepare complete - status=0
02-10 01:36:41.437: VERBOSE/MediaPlayer-JNI(8371): native_finalize
02-10 01:36:41.437: VERBOSE/MediaPlayer-JNI(8371): release
02-10 01:36:41.437: VERBOSE/MediaPlayer(8371): setListener
02-10 01:36:41.437: VERBOSE/MediaPlayer(8371): disconnect
02-10 01:36:41.437: VERBOSE/MediaPlayer(8371): destructor
02-10 01:36:41.437: VERBOSE/MediaPlayer(8371): disconnect

, !

+3
2

WAV OGG Audio Streaming MediaPlayer Samsung Galaxy TAB ( FroYo). , API Demo (8), /Demos/src/com/example/android/apis/media/MediaPlayerDemo_Audio.java:

    private void playAudio(Integer media) {
        try {
            switch (media) {
                case LOCAL_AUDIO:
                    /**
                     * TODO: Set the path variable to a local audio file path.
                     */
//                  path = "http://upload.wikimedia.org/wikipedia/commons/a/a9/Tromboon-sample.ogg";
//                  path = "http://www.robtowns.com/music/blind_willie.mp3";
                    path = "http://www.nch.com.au/acm/8k16bitpcm.wav";
                    if (path == "") {
                        // Tell the user to provide an audio file URL.
                        Toast
                                .makeText(
                                        MediaPlayerDemo_Audio.this,
                                        "Please edit MediaPlayer_Audio Activity, "
                                                + "and set the path variable to your audio file path."
                                                + " Your audio file must be stored on sdcard.",
                                        Toast.LENGTH_LONG).show();

                    }
                    mMediaPlayer = new MediaPlayer();
                    Uri tempUri = Uri.parse(path);
                    try {
                        mMediaPlayer.setDataSource(this, tempUri);
                    }
                    catch (IllegalStateException e) {
                        Log.d(TAG, "IllegalStateException: " + e.getMessage());
                    }
                    catch (IOException e) {
                        Log.d(TAG, "IOException: " + e.getMessage());
                    }
                    catch (IllegalArgumentException e) {
                        Log.d(TAG, "IllegalArgumentException: " + e.getMessage());
                    }
                    catch (SecurityException e) {
                        Log.d(TAG, "SecurityException: " + e.getMessage());
                    }
                    mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
                    mMediaPlayer.prepare();
                    mMediaPlayer.start();
                    break;
                case RESOURCES_AUDIO:
                    /**
                     * TODO: Upload a audio file to res/raw folder and provide
                     * its resid in MediaPlayer.create() method.
                     */
                    mMediaPlayer = MediaPlayer.create(this, R.raw.test_cbr);
                    mMediaPlayer.start();

            }
            tx.setText("Playing audio...");

        } catch (Exception e) {
            Log.e(TAG, "error: " + e.getMessage(), e);
        }

    }

3 , , - . , Mp3 , WAV, OGG, , , .

- ? , ?

+3

, AudioEncoder.AMR_NB, 3G, Wifi, Mp3 . .

0

Source: https://habr.com/ru/post/1790810/


All Articles