play audio by default when ringer mode is normal

This commit is contained in:
Mariotaku Lee 2016-06-26 21:40:17 +08:00
parent 346ad297f6
commit 5f5278f0ed
1 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.media.AudioManager;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
@ -1047,6 +1048,12 @@ public final class MediaViewerActivity extends BaseActivity implements IExtended
if (handler == null) { if (handler == null) {
handler = new Handler(getActivity().getMainLooper()); handler = new Handler(getActivity().getMainLooper());
} }
AudioManager am = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
// Play audio by default if ringer mode on
mPlayAudio = am.getRingerMode() == AudioManager.RINGER_MODE_NORMAL;
mVideoProgressRunnable = new VideoPlayProgressRunnable(handler, mVideoViewProgress, mVideoProgressRunnable = new VideoPlayProgressRunnable(handler, mVideoViewProgress,
mDurationLabel, mPositionLabel, mVideoView); mDurationLabel, mPositionLabel, mVideoView);