title: Android MediaPlayer play m3u8 only audio streamming not worked
body: <p>Hi every one i write a code to play fm radio waves. In my code there are a progressbar and two buttons one of them for play and another for stop. when i click play button it not happen. how can i solve this problem? or is there good suggest for me to play audio m3u8 files?<br>
  The code I'm using is:</p>
  
  <pre><code>    public class Main extends Activity implements OnClickListener {
  
      private ProgressBar playSeekBar;
  
      private Button buttonPlay;
  
      private Button buttonStopPlay;
  
      private MediaPlayer player;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          initializeUIElements();
  
          initializeMediaPlayer();
  
      }
  
      private void initializeUIElements() {
  
          playSeekBar = (ProgressBar) findViewById(R.id.progressBar1);
          playSeekBar.setMax(100);
          playSeekBar.setVisibility(View.INVISIBLE);
  
          buttonPlay = (Button) findViewById(R.id.buttonPlay);
          buttonPlay.setOnClickListener(this);
  
          buttonStopPlay = (Button) findViewById(R.id.buttonStopPlay);
          buttonStopPlay.setEnabled(false);
          buttonStopPlay.setOnClickListener(this);
  
      }
  
      public void onClick(View v) {
          if (v == buttonPlay) {
              startPlaying();
          } else if (v == buttonStopPlay) {
              stopPlaying();
          }
      }
  
      private void startPlaying() {
          buttonStopPlay.setEnabled(true);
          buttonPlay.setEnabled(false);
  
          playSeekBar.setVisibility(View.VISIBLE);
  
          player.prepareAsync();
  
          player.setOnPreparedListener(new OnPreparedListener() {
  
              public void onPrepared(MediaPlayer mp) {
                  player.start();
              }
          });
  
      }
  
      private void stopPlaying() {
          if (player.isPlaying()) {
              player.stop();
              player.release();
              initializeMediaPlayer();
          }
  
          buttonPlay.setEnabled(true);
          buttonStopPlay.setEnabled(false);
          playSeekBar.setVisibility(View.INVISIBLE);
      }
  
      private void initializeMediaPlayer() {
          player = new MediaPlayer();
          try {
  
              player.setDataSource("http://url.m3u8");
          } catch (IllegalArgumentException e) {
              e.printStackTrace();
          } catch (IllegalStateException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          player.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {
  
              public void onBufferingUpdate(MediaPlayer mp, int percent) {
                  playSeekBar.setSecondaryProgress(percent);
                  Log.i("Buffering", "" + percent);
              }
          });
      }
  
      @Override
      protected void onPause() {
          super.onPause();
          if (player.isPlaying()) {
              player.stop();
          }
      }
  }
  </code></pre>