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

Side by Side Diff: media/blink/webmediaplayer_delegate.h

Issue 1570043002: Implement MediaSession on top of the WebMediaPlayerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_session
Patch Set: Reorder. Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « media/blink/webmediaplayer_cast_android.cc ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_
7 7
8 namespace blink { 8 namespace blink {
9 class WebMediaPlayer; 9 class WebMediaPlayer;
10 } 10 }
11 namespace media { 11 namespace media {
12 12
13 // An interface to allow a WebMediaPlayerImpl to communicate changes of state 13 // An interface to allow a WebMediaPlayerImpl to communicate changes of state
14 // to objects that need to know. 14 // to objects that need to know.
15 class WebMediaPlayerDelegate { 15 class WebMediaPlayerDelegate {
16 public: 16 public:
17 class Observer { 17 class Observer {
18 public: 18 public:
19 virtual void OnHidden() = 0; 19 virtual void OnHidden() = 0;
20 virtual void OnShown() = 0; 20 virtual void OnShown() = 0;
21 virtual void OnPlay() = 0;
22 virtual void OnPause() = 0;
23
24 // Playout volume should be set to current_volume * multiplier. The range
25 // is [0, 1] and is typically 1.
26 virtual void OnVolumeMultiplierUpdate(double multiplier) = 0;
21 }; 27 };
22 28
23 WebMediaPlayerDelegate() {} 29 WebMediaPlayerDelegate() {}
24 30
31 // Subscribe or unsubscribe from observer callbacks respectively. A client
32 // must use the delegate id returned by AddObserver() for all other calls.
33 virtual int AddObserver(Observer* observer) = 0;
34 virtual void RemoveObserver(int delegate_id) = 0;
35
25 // The specified player started playing media. 36 // The specified player started playing media.
26 virtual void DidPlay(blink::WebMediaPlayer* player) = 0; 37 virtual void DidPlay(int delegate_id,
38 bool has_video,
39 bool has_audio,
40 bool is_remote,
41 base::TimeDelta duration) = 0;
27 42
28 // The specified player stopped playing media. 43 // The specified player stopped playing media.
29 virtual void DidPause(blink::WebMediaPlayer* player) = 0; 44 virtual void DidPause(int delegate_id, bool reached_end_of_stream) = 0;
30 45
31 // The specified player was destroyed. Do not call any methods on it. 46 // The specified player was destroyed or suspended. This may be called
32 // (RemoveObserver() is still necessary if the player is also an observer.) 47 // multiple times in row. Note: Clients must still call RemoveObserver() to
33 virtual void PlayerGone(blink::WebMediaPlayer* player) = 0; 48 // unsubscribe from callbacks.
34 49 virtual void PlayerGone(int delegate_id) = 0;
35 // Subscribe to observer callbacks.
36 virtual void AddObserver(Observer* observer) = 0;
37
38 // Unsubscribe from observer callbacks.
39 virtual void RemoveObserver(Observer* observer) = 0;
40 50
41 // Returns whether the render frame is currently hidden. 51 // Returns whether the render frame is currently hidden.
42 virtual bool IsHidden() = 0; 52 virtual bool IsHidden() = 0;
43 53
44 protected: 54 protected:
45 virtual ~WebMediaPlayerDelegate() {} 55 virtual ~WebMediaPlayerDelegate() {}
46 }; 56 };
47 57
48 } // namespace media 58 } // namespace media
49 59
50 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ 60 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_cast_android.cc ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698