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

Unified Diff: media/blink/webmediaplayer_delegate.h

Issue 1766783003: Expand suspension of idle media players to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notify_pause
Patch Set: Fixup API comments. Created 4 years, 9 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 | « content/renderer/media/webmediaplayer_ms_unittest.cc ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_delegate.h
diff --git a/media/blink/webmediaplayer_delegate.h b/media/blink/webmediaplayer_delegate.h
index 7ae31df780b888b8248e41d92e5fd338a3c35e23..30dfc91f5dc3687adead5ee8ed7c1ebc92abdbd9 100644
--- a/media/blink/webmediaplayer_delegate.h
+++ b/media/blink/webmediaplayer_delegate.h
@@ -16,16 +16,26 @@ class WebMediaPlayerDelegate {
public:
class Observer {
public:
- // Called when the WebMediaPlayer is no longer in the foreground. Audio may
- // continue in the background unless |must_suspend| is true.
- virtual void OnHidden(bool must_suspend) = 0;
-
+ // Called when the WebMediaPlayer enters the background or foreground
+ // respectively. Note: Some implementations will stop playback when hidden,
+ // and thus subsequently call WebMediaPlayerDelegate::PlayerGone().
+ virtual void OnHidden() = 0;
virtual void OnShown() = 0;
+
+ // Requests a WebMediaPlayer instance to release all idle resources. If
+ // |must_suspend| is true, the player must stop playback, release all idle
+ // resources, and finally call WebMediaPlayerDelegate::PlayerGone(). If
+ // |must_suspend| is false, the player may ignore the request. Optionally,
+ // it may do some or all of the same actions as when |must_suspend| is true.
+ // To be clear, the player is not required to call PlayerGone() when
+ // |must_suspend| is false.
+ virtual void OnSuspendRequested(bool must_suspend) = 0;
+
virtual void OnPlay() = 0;
virtual void OnPause() = 0;
- // Playout volume should be set to current_volume * multiplier. The range
- // is [0, 1] and is typically 1.
+ // Playout volume should be set to current_volume * multiplier. The range is
+ // [0, 1] and is typically 1.
virtual void OnVolumeMultiplierUpdate(double multiplier) = 0;
};
@@ -46,7 +56,8 @@ class WebMediaPlayerDelegate {
// The specified player stopped playing media.
virtual void DidPause(int delegate_id, bool reached_end_of_stream) = 0;
- // The specified player was destroyed or suspended. This may be called
+ // The specified player was destroyed or suspended and will no longer accept
+ // Observer::OnPlay() or Observer::OnPause() calls. This may be called
// multiple times in row. Note: Clients must still call RemoveObserver() to
// unsubscribe from callbacks.
virtual void PlayerGone(int delegate_id) = 0;
« no previous file with comments | « content/renderer/media/webmediaplayer_ms_unittest.cc ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698