是否有任何Android媒体播放器的例子在通知中添加播放器控件?

时间:2022-06-21 18:57:19

Is there any example for android media player with notification to add player controls like play/pause,previous and next button?

有没有任何Android媒体播放器的例子,通知添加播放/暂停,上一个和下一个按钮等播放器控件?

2 个解决方案

#1


0  

//--MediaPlayerControl methods----------------------------------------------------

// - MediaPlayerControl方法-------------------------------------------- --------

     public void start() {
     mediaPlayer.start();
  }

     public void pause() {
     mediaPlayer.pause();
  }

    public int getDuration() {
    return mediaPlayer.getDuration();
  }

    public int getCurrentPosition() {
    return mediaPlayer.getCurrentPosition();
  }

    public void seekTo(int i) {
    mediaPlayer.seekTo(i);
  }

    public boolean isPlaying() {
    return mediaPlayer.isPlaying();
  }

    public int getBufferPercentage() {
    return 0;
  }

    public boolean canPause() {
    return true;
 }

    public boolean canSeekBackward() {
    return true;
 }

    public boolean canSeekForward() {
    return true;
 }

#2


0  

MediaController mediaController = new MediaController(this);
VideoView.setMediaController(mediaController);

Use MediaController?

使用MediaController?

#1


0  

//--MediaPlayerControl methods----------------------------------------------------

// - MediaPlayerControl方法-------------------------------------------- --------

     public void start() {
     mediaPlayer.start();
  }

     public void pause() {
     mediaPlayer.pause();
  }

    public int getDuration() {
    return mediaPlayer.getDuration();
  }

    public int getCurrentPosition() {
    return mediaPlayer.getCurrentPosition();
  }

    public void seekTo(int i) {
    mediaPlayer.seekTo(i);
  }

    public boolean isPlaying() {
    return mediaPlayer.isPlaying();
  }

    public int getBufferPercentage() {
    return 0;
  }

    public boolean canPause() {
    return true;
 }

    public boolean canSeekBackward() {
    return true;
 }

    public boolean canSeekForward() {
    return true;
 }

#2


0  

MediaController mediaController = new MediaController(this);
VideoView.setMediaController(mediaController);

Use MediaController?

使用MediaController?