Beispiel #1
0
  @Override
  public void startStream() {

    if (streamingListener == null) {
      streamingListener = (StreamingListener) mSectionsPagerAdapter.getFragment(0);
    }

    if (streamingListener != null) {
      streamingListener.onStreamingStart();
    }

    if (mediaPlayer == null) {
      mediaPlayer = new AACPlayer(this);
      mediaPlayer.setAudioBufferCapacityMs(3000);
      mediaPlayer.setDecodeBufferCapacityMs(1500);

      // untuk mencegak proses koneksi berulang pada protokol ICY
      // (Shoutcast streaming)
      mediaPlayer.setResponseCodeCheckEnabled(false);
    }

    if (mediaPlayer != null) {
      mediaPlayer.playAsync(RADIO_CHANNEL, 32);
    }
  }
Beispiel #2
0
 @Override
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case MESSAGE_TOAST:
       Toast.makeText(
               getApplicationContext(), msg.getData().getString(TOAST), Toast.LENGTH_SHORT)
           .show();
       break;
     case MESSAGE_ERROR:
       showError(msg.getData().getString(ERROR));
       break;
     case MESSAGE_UPDATELOGS:
       logginPage mLog = (logginPage) mSectionsPagerAdapter.getFragment(3);
       if (mLog != null) {
         mLog.setLogs(logs);
       }
       break;
     case MESSAGE_UPDATEBATTERY:
       manualControlPage mPage = (manualControlPage) mSectionsPagerAdapter.getFragment(0);
       if (mPage != null) {
         mPage.setBatteryLevel(batteryLevel);
       }
   }
 }