Home » Android » How can i stream mp3 files from a server using MediaPlayer? [on hold]

How can i stream mp3 files from a server using MediaPlayer? [on hold]

Posted by: admin November 1, 2017 Leave a comment

Questions:
  • 10-22 05:28:17.024 16861-15468/? D/FFmpegExtractor: SniffFFMPEG failed to sniff this source
    10-22 05:28:17.027 16861-15467/? D/NuPlayerDriver: notifyListener_l(0xf1b2d000), (3, 3, 0)
    10-22 05:28:17.030 16861-15467/? D/NuPlayerDriver: notifyListener_l(0xf1b2d000), (1, 0, 0)
    10-22 05:28:17.030 13016-13016/com.example.therealisback.pentecoastalinternational D/MediaPlayer: setSubtitleAnchor in MediaPlayer
    10-22 05:28:17.036 16861-17233/? D/NuPlayerDriver: start(0xf1b2d000), state is 4, eos is 0
    10-22 05:28:17.036 16861-15467/? I/GenericSource: start
    10-22 05:28:17.037 16861-17234/? D/NuPlayerDriver: reset(0xf1b2d000)
    10-22 05:28:17.037 16861-17234/? D/NuPlayerDriver: notifyListener_l(0xf1b2d000), (8, 0, 0)
    10-22 05:28:17.037 16861-15477/? I/NuCachedSource2: caching reached eos.
    10-22 05:28:17.038 16861-15467/? D/NuPlayerDriver: notifyListener_l(0xf1b2d000), (3, 4, 0)
    10-22 05:28:17.042 16861-15481/? E/OMXNodeInstance: setConfig(29:google.mp3.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    10-22 05:28:17.042 16861-15481/? I/ACodec: codec does not support config priority (err -2147483648)
    10-22 05:28:17.043 16861-15481/? I/MediaCodec: MediaCodec will operate in async mode
    10-22 05:28:17.047 16861-15467/? W/AMessage: failed to post message as target looper for handler 0 is gone.

those are log cat values

live.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            try {

                mediaplayer.setDataSource(AudioURL);
                mediaplayer.prepare();


            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (SecurityException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalStateException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            mediaplayer.start();
        }
    });

thats the code i am using to stream from a serverin log cat all the mp3 file details can be fetched from the server but it cant be played in an emulator. any help will be highly appreciated

Answers: