我已经实现了exoplayer通知管理器,并希望检测播放或暂停动作,以便我可以相应地更新用户界面
我试过这个代码
'
player.addListener(new Player.DefaultEventListener() {
@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playWhenReady && playbackState == Player.STATE_READY) {
// media actually playing
} else if (playWhenReady) {
// might be idle (plays after prepare()),
// buffering (plays when data available)
// or ended (plays when seek away from end)
} else {
// player paused in any state
}
}
});
'
我从这里得到的-https://stackoverflow.com/a/48067205/13312583
但是它不起作用,这件事有什么方法吗?
1条答案
按热度按时间xzabzqsa1#
您可以用途: