private void startStreamingAudio(String url, File folder) {
    try {
      if (audioStreamer != null) {
        audioStreamer.interrupt();
      }
      audioStreamer =
          new StreamingMediaPlayer(
              this, mPlayButton, streamButton, mProgressBar, folder, mStreamTxt);
      audioStreamer.startStreaming(url);

      synchronized (mutex) {
        mutex.notify();
        this.waitForBuffer = false;
      }

      // lv is null
      SecurityNow sn = (SecurityNow) this.getApplication();
      sn.smp = audioStreamer;
      //    			mutex = new Object();
      // audioStreamer.startStreaming("http://www.pocketjourney.com/downloads/pj/tutorials/audio.mp3",1677, 214);
      // streamButton.setEnabled(false);
    } catch (IOException e) {
      Log.e(getClass().getName(), "Error starting to stream audio.", e);
    }
  }
 // When the user stops touching the seekbar
 public void onStopTrackingTouch(SeekBar seekBar) {
   if (audioStreamer.isDownloaded()) {
     float seekBarProgress = (float) seekBar.getProgress() / (float) seekBar.getMax();
     // progressBar.setProgress((int)seekBarProgress*progressBar.getMax());
     audioStreamer.seekTo(seekBarProgress);
   }
 }
        public void onClick(View v) {
          if (waitForBuffer) {
            synchronized (mutex) {
              try {
                mutex.wait();
              } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
            }
          }

          // startSpinner();
          MediaPlayer mp = audioStreamer.getMediaPlayer();
          audioStreamer.playButton();
          isPlaying = !isPlaying;
        }
Ejemplo n.º 4
0
 public void run() {
   if (StreamingMediaPlayer.e(b.a)) {
     if (a == -15) {
       b.a.a(4);
     }
   }
   do {
     return;
     StreamingMediaPlayer.b(b.a, false);
     return;
     b.a.a(5);
   } while (StreamingMediaPlayer.f(b.a).getProgress() != 0);
   StreamingMediaPlayer.f(b.a).setMax((int) StreamingMediaPlayer.g(b.a));
   StreamingMediaPlayer.f(b.a).incrementProgressBy((int) StreamingMediaPlayer.h(b.a));
 }