There is an isMusicActive() method in AudioManager, which can be used to determine whether music or video is currently playing.
/**
* 判断是否在播放音乐或者视频
* @param context
* @return
*/
private boolean isMusicOrVideoPlay(Context context){
AudioManager audioManager = (AudioManager) context.getSystemService(AUDIO_SERVICE);
return audioManager.isMusicActive();
}
As above method, call isMusicOrVideoPlay() to know whether the current video is playing.