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

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

Issue 1259633002: NOT FOR LANDING Implement WebMediaSession (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hack until something works Created 5 years, 4 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
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 a8b64efec4c97877fd06bbb644fb14dc63781919..0c66243dc03665c0debe241efc5934416a46be09 100644
--- a/content/browser/media/android/media_session.cc
+++ b/content/browser/media/android/media_session.cc
@@ -55,6 +55,26 @@ MediaSession::~MediaSession() {
DCHECK(audio_focus_state_ == State::INACTIVE);
}
+bool MediaSession::Activate() {
+ if (audio_focus_state_ == State::ACTIVE)
+ return true;
+
+ const Type type = Type::Content;
+ if (!RequestSystemAudioFocus(type))
+ return false;
+
+ audio_focus_state_ = State::ACTIVE;
+ audio_focus_type_ = type;
+ UpdateWebContents();
+
+ return true;
+}
+
+void MediaSession::Deactivate() {
+ AbandonSystemAudioFocusIfNeeded();
mlamouri (slow - plz ping) 2015/08/24 12:55:24 Looking at that code, it's a bit odd that RequestS
philipj_slow 2015/08/26 07:39:48 Yes, this doesn't make any sense, I just hacked un
+ DCHECK(audio_focus_state_ == State::INACTIVE);
+}
+
bool MediaSession::AddPlayer(MediaSessionObserver* observer,
int player_id,
Type type) {

Powered by Google App Engine
This is Rietveld 408576698