I'm trying to play music from the network. The problem is that the program knocks an error. With a method of poking I found that the problem with mediaPlayer.prepareAsync () ;. Who knows how to properly play music from the network.?
MediaPlayer mediaPlayer = MyPlayer.getMediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try { mediaPlayer.reset(); mediaPlayer.setDataSource(s); mediaPlayer.prepareAsync(); //if(type==11){mediaPlayer.prepareAsync();} } catch (IOException e) { Toast.makeText(ctx,"error",Toast.LENGTH_SHORT).show(); } mediaPlayer. setOnPreparedListener(new OnPreparedListener(){ @Override public void onPrepared(MediaPlayer mp) { mp.start(); } });
программа выбивает ошибку, then you must attach thestacktracethis error - Vladyslav Matviienko