// 取消声音渐变的
 public void simplePause() {
   if (!messageQueue.inThread()) {
     throw new RuntimeException("simplePause must run on MediaPlayerService handler Thread");
   }
   try {
     if (mMediaPlayer != null) {
       if (hasReady) {
         LogManager.d(TAG, "simplePause()");
         mMediaPlayer.setVolume(1, 1);
         mMediaPlayer.pause();
       } else {
         LogManager.d(TAG, "simplePause() is ignore! mediaPlayer is not ready");
       }
     }
   } catch (IllegalStateException e) {
     LogManager.printStackTrace(e);
   } catch (Exception e) {
     LogManager.printStackTrace(e);
   }
 }
  public void onStatusClick(TouchStatus status) {
    switch (status) {
      case TOUCH_BEGIN:
        isNewTouch = true;
        touchBeginTime = System.currentTimeMillis();
        isCalledClickInTouch = false;
        isCalledLongClickInTouch = false;
        this.onTouchBegin();
        break;
      case TOUCH_ED:
        if ((System.currentTimeMillis() - touchBeginTime) > LONG_CLICK_TIME
            && !isCalledClickInTouch) {
          isCalledClickInTouch = true;
          LogManager.d(TAG, "onClickInTouch...");
          onClickInTouch();
        } else if ((System.currentTimeMillis() - touchBeginTime) > LONG_LONG_CLICK_TIME
            && !isCalledLongClickInTouch) {
          isCalledLongClickInTouch = true;
          LogManager.d(TAG, "onLongClickInTouch...");
          onLongClickInTouch();
        }
        break;
      case TOUCH_END: // 开始按键与结束按键值不一样
        this.onTouchEnd();
        if (System.currentTimeMillis() - touchBeginTime < LONG_CLICK_TIME) {
          onShortClick();
        } else if ((System.currentTimeMillis() - touchBeginTime) > LONG_CLICK_TIME
            && (System.currentTimeMillis() - touchBeginTime) < LONG_LONG_CLICK_TIME) {
          LogManager.d(TAG, "onLongClick...");
          onLongClick();
        } else {
          LogManager.d(TAG, "onLongLongClick...");
          onLongLongClick();
        }

        break;

      default:
        break;
    }
  }
  public void dlnaStop() {
    if (!messageQueue.inThread()) {
      throw new RuntimeException("stop must run on MediaPlayerService handler Thread");
    }
    try {
      LogManager.d(TAG, "dlna-----stop");
      reset();
      mMediaPlayer.reset();

    } catch (Exception e) {
      LogManager.printStackTrace(e);
    }
  }
 public void start() {
   if (!messageQueue.inThread()) {
     throw new RuntimeException("start must run on MediaPlayerService handler Thread");
   }
   try {
     if (mMediaPlayer != null) {
       if (hasReady) {
         LogManager.d(TAG, "start()");
         mMediaPlayer.setVolume(0, 0);
         mMediaPlayer.start();
         // 声音渐进
         MediaPlayerUtil.autoIncreaseVloume(context, mMediaPlayer, true);
       } else {
         LogManager.d(TAG, "start() is ignore! mediaPlayer is not ready");
       }
     }
   } catch (IllegalStateException e) {
     LogManager.printStackTrace(e);
   } catch (Exception e) {
     LogManager.printStackTrace(e);
   }
 }
 public void seekTo(int pos) {
   if (!messageQueue.inThread()) {
     throw new RuntimeException("seekTo must run on MediaPlayerService handler Thread");
   }
   try {
     if (mMediaPlayer != null) {
       if (hasReady) {
         int d = getDuration();
         if (pos <= d) {
           LogManager.d(TAG, "seekTo (" + pos + ")");
         } else {
           LogManager.d(TAG, "seekTo error pos > Duration :" + pos + "/" + d + ")");
         }
         mMediaPlayer.seekTo(pos);
       } else {
         LogManager.d(TAG, "seekTo(" + pos + ") is ignore! mediaPlayer is not ready");
       }
     }
   } catch (IllegalStateException e) {
     LogManager.printStackTrace(e);
   } catch (Exception e) {
     LogManager.printStackTrace(e);
   }
 }
  public void release() {
    if (!messageQueue.inThread()) {
      throw new RuntimeException("release must run on MediaPlayerService handler Thread");
    }

    try {
      if (mMediaPlayer != null) {
        LogManager.d(TAG, "release()");
        mMediaPlayer.release();
        reset();
      }
    } catch (IllegalStateException e) {
      LogManager.printStackTrace(e);
    } catch (Exception e) {
      LogManager.printStackTrace(e);
    }
  }
 @Override
 public void onCreate() {
   super.onCreate();
   LogManager.d("view launch");
   this.startService(new Intent(this, UpgradeService.class));
 }
  // ****************操作命令****************** //
  public void setMediaInfoList(String path) {
    if (!messageQueue.inThread()) {
      throw new RuntimeException("setMediaInfoList must run on MediaPlayerService handler Thread");
    }
    try {
      LogManager.d(TAG, "setMediaInfoList", "set Path:" + path);
      // 复用播放器
      hasReady = false;
      mMediaPlayer.reset();

      if (mBaseContext.getPrefBoolean(KeyList.PKEY_CUREENT_MUSIC_IS_DLAN, false)) {
        LogManager.d(TAG, "setMediaInfoList dlan音乐");
        mMediaPlayer.setDataSource(path);
        mMediaPlayer.prepareAsync();
        mMediaPlayer.setOnPreparedListener(
            new OnPreparedListener() {

              @Override
              public void onPrepared(MediaPlayer mp) {
                // TODO Auto-generated method stub
                if (preparedListener != null) {
                  preparedListener.onPrepared(mp);
                }
              }
            });
        // 统计第三方协议播放
        mBaseContext.sendUmengEvent(
            UmengUtil.THE_THIRD_PROTOCOL_PLAY, UmengUtil.THE_THIRD_PROTOCOL_PLAY_CONTENT);
      } else if (path.startsWith("http")) {
        LogManager.d(TAG, "setMediaInfoList 代理音乐");

        String localMusicCache = HttpGetProxyUtils.getLocalOrCacheMusicsPath(path);
        if (localMusicCache != null) {
          mMediaPlayer.setDataSource(localMusicCache);
        } else {
          String mypath = HttpProxy.proxyHttpUrl + path;
          mMediaPlayer.setDataSource(mypath);
        }
      } else {
        LogManager.d(TAG, "setMediaInfoList 普通音乐");
        if (path.startsWith(MusicInfoManager.MUSIC_SAVE_POSE)) {
          int currentLocalMusicId =
              Integer.parseInt(path.replace(MusicInfoManager.MUSIC_SAVE_POSE, ""));
          // 记录当前歌曲ID
          mBaseContext.setPrefInteger(KeyList.CURRENT_LOCAL_MUSIC_ID, currentLocalMusicId);
        }
        mMediaPlayer.setDataSource(path);
      }

      if (!mBaseContext.getPrefBoolean(KeyList.PKEY_CUREENT_MUSIC_IS_DLAN, false)) {
        mMediaPlayer.prepare();
      }

      // 阻塞播放器
      hasReady = true;
    } catch (IOException e) {
      LogManager.printStackTrace(e, "MediaPlayerService", "setMediaInfoList");
      LogManager.e("path:" + path + " is invaild!");
      // 无法复用播放器
      hasReady = false;
      try {
        if (onErrorListener != null) {
          onErrorListener.onError(mMediaPlayer, MEDIA_ERROR_TRY, currentPosition);
        }
      } catch (IllegalStateException e1) {
        LogManager.printStackTrace(e1);
      } catch (Exception e1) {
        LogManager.printStackTrace(e1);
      }
    } catch (Exception e) {
      LogManager.printStackTrace(e, "MediaPlayerService", "setMediaInfoList");
    }
  }