W
W
websteam2018-12-06 13:46:23
Java
websteam, 2018-12-06 13:46:23

Why doesn't MediaPlayer work on android 9?

Music streaming won't start on android 9

if (isOnline()) {
            mediaPlayer = new MediaPlayer();
            mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            try {
                Log.d("STATE_STREAM", "PLAY");
                mediaPlayer.setDataSource(stream);
                mediaPlayer.prepare(); // might take long! (for buffering, etc)
                mediaPlayer.start();
                state = true;
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            Toast.makeText(getApplicationContext(), "Проверьте подключение к интернерту!", Toast.LENGTH_SHORT).show();
        }

Gives an error message
5c08fdf6e5a2e221449490.jpeg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question