Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: content/browser/media/android/media_session.cc

Issue 1266903002: [MediaSession,Android] Request audio focus if needed when resuming playback from UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/android/media_session.cc
diff --git a/content/browser/media/android/media_session.cc b/content/browser/media/android/media_session.cc
index b52e67a8c697127a2fa151afa85ce62bd685c36a..a8b64efec4c97877fd06bbb644fb14dc63781919 100644
--- a/content/browser/media/android/media_session.cc
+++ b/content/browser/media/android/media_session.cc
@@ -128,6 +128,14 @@ void MediaSession::OnResume(JNIEnv* env, jobject obj) {
void MediaSession::Resume() {
DCHECK(IsSuspended());
+ // Request audio focus again in case we lost it because another app started
+ // playing while the playback was paused.
+ audio_focus_state_ = RequestSystemAudioFocus(audio_focus_type_)
+ ? State::ACTIVE
+ : State::INACTIVE;
+ if (audio_focus_state_ != State::ACTIVE)
+ return;
+
OnResumeInternal(SuspendType::UI);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698