OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_RENDERER_MEDIA_PLAYER_INTERFACE_H_ | 5 #ifndef MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_ |
6 #define MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_ | 6 #define MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_ |
7 | 7 |
8 // This file contains interfaces modeled after classes in | 8 // This file contains interfaces modeled after classes in |
9 // content/renderer/media/android for the purposes of letting clases in | 9 // content/renderer/media/android for the purposes of letting clases in |
10 // this directory implement and/or interact with those classes. | 10 // this directory implement and/or interact with those classes. |
11 // It's a stop-gap used to support cast on android until a better solution | 11 // It's a stop-gap used to support cast on android until a better solution |
12 // is implemented: crbug/575276 | 12 // is implemented: crbug/575276 |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "media/blink/webmediaplayer_delegate.h" | 16 #include "media/blink/webmediaplayer_delegate.h" |
17 #include "ui/gfx/geometry/rect_f.h" | 17 #include "ui/gfx/geometry/rect_f.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
20 // Dictates which type of media playback is being initialized. | 20 // Dictates which type of media playback is being initialized. |
21 enum MediaPlayerHostMsg_Initialize_Type { | 21 enum MediaPlayerHostMsg_Initialize_Type { |
22 MEDIA_PLAYER_TYPE_URL, | 22 MEDIA_PLAYER_TYPE_URL, |
23 MEDIA_PLAYER_TYPE_MEDIA_SOURCE, | |
24 MEDIA_PLAYER_TYPE_REMOTE_ONLY, | 23 MEDIA_PLAYER_TYPE_REMOTE_ONLY, |
25 MEDIA_PLAYER_TYPE_LAST = MEDIA_PLAYER_TYPE_REMOTE_ONLY | 24 MEDIA_PLAYER_TYPE_LAST = MEDIA_PLAYER_TYPE_REMOTE_ONLY |
26 }; | 25 }; |
27 | 26 |
28 namespace media { | 27 namespace media { |
29 | 28 |
30 class RendererMediaPlayerInterface { | 29 class RendererMediaPlayerInterface { |
31 public: | 30 public: |
32 virtual void OnMediaMetadataChanged(base::TimeDelta duration, | 31 virtual void OnMediaMetadataChanged(base::TimeDelta duration, |
33 int width, | 32 int width, |
34 int height, | 33 int height, |
35 bool success) = 0; | 34 bool success) = 0; |
36 virtual void OnPlaybackComplete() = 0; | 35 virtual void OnPlaybackComplete() = 0; |
37 virtual void OnBufferingUpdate(int percentage) = 0; | 36 virtual void OnBufferingUpdate(int percentage) = 0; |
38 virtual void OnSeekRequest(const base::TimeDelta& time_to_seek) = 0; | 37 virtual void OnSeekRequest(const base::TimeDelta& time_to_seek) = 0; |
39 virtual void OnSeekComplete(const base::TimeDelta& current_time) = 0; | 38 virtual void OnSeekComplete(const base::TimeDelta& current_time) = 0; |
40 virtual void OnMediaError(int error_type) = 0; | 39 virtual void OnMediaError(int error_type) = 0; |
41 virtual void OnVideoSizeChanged(int width, int height) = 0; | 40 virtual void OnVideoSizeChanged(int width, int height) = 0; |
42 | 41 |
43 // Called to update the current time. | 42 // Called to update the current time. |
44 virtual void OnTimeUpdate(base::TimeDelta current_timestamp, | 43 virtual void OnTimeUpdate(base::TimeDelta current_timestamp, |
45 base::TimeTicks current_time_ticks) = 0; | 44 base::TimeTicks current_time_ticks) = 0; |
46 | 45 |
47 virtual void OnWaitingForDecryptionKey() = 0; | |
48 virtual void OnPlayerReleased() = 0; | 46 virtual void OnPlayerReleased() = 0; |
49 | 47 |
50 // Functions called when media player status changes. | 48 // Functions called when media player status changes. |
51 virtual void OnConnectedToRemoteDevice( | 49 virtual void OnConnectedToRemoteDevice( |
52 const std::string& remote_playback_message) = 0; | 50 const std::string& remote_playback_message) = 0; |
53 virtual void OnDisconnectedFromRemoteDevice() = 0; | 51 virtual void OnDisconnectedFromRemoteDevice() = 0; |
54 virtual void OnCancelledRemotePlaybackRequest() = 0; | 52 virtual void OnCancelledRemotePlaybackRequest() = 0; |
55 virtual void OnDidExitFullscreen() = 0; | 53 virtual void OnDidExitFullscreen() = 0; |
56 virtual void OnMediaPlayerPlay() = 0; | 54 virtual void OnMediaPlayerPlay() = 0; |
57 virtual void OnMediaPlayerPause() = 0; | 55 virtual void OnMediaPlayerPause() = 0; |
(...skipping 11 matching lines...) Expand all Loading... |
69 virtual void SuspendAndReleaseResources() = 0; | 67 virtual void SuspendAndReleaseResources() = 0; |
70 }; | 68 }; |
71 | 69 |
72 class RendererMediaPlayerManagerInterface { | 70 class RendererMediaPlayerManagerInterface { |
73 public: | 71 public: |
74 // Initializes a MediaPlayerAndroid object in browser process. | 72 // Initializes a MediaPlayerAndroid object in browser process. |
75 virtual void Initialize(MediaPlayerHostMsg_Initialize_Type type, | 73 virtual void Initialize(MediaPlayerHostMsg_Initialize_Type type, |
76 int player_id, | 74 int player_id, |
77 const GURL& url, | 75 const GURL& url, |
78 const GURL& first_party_for_cookies, | 76 const GURL& first_party_for_cookies, |
79 int demuxer_client_id, | |
80 const GURL& frame_url, | 77 const GURL& frame_url, |
81 bool allow_credentials, | 78 bool allow_credentials, |
82 int delegate_id) = 0; | 79 int delegate_id) = 0; |
83 | 80 |
84 // Starts the player. | 81 // Starts the player. |
85 virtual void Start(int player_id) = 0; | 82 virtual void Start(int player_id) = 0; |
86 | 83 |
87 // Pauses the player. | 84 // Pauses the player. |
88 // is_media_related_action should be true if this pause is coming from an | 85 // is_media_related_action should be true if this pause is coming from an |
89 // an action that explicitly pauses the video (user pressing pause, JS, etc.) | 86 // an action that explicitly pauses the video (user pressing pause, JS, etc.) |
(...skipping 23 matching lines...) Expand all Loading... |
113 virtual void RequestRemotePlaybackControl(int player_id) = 0; | 110 virtual void RequestRemotePlaybackControl(int player_id) = 0; |
114 | 111 |
115 // Registers and unregisters a RendererMediaPlayerInterface object. | 112 // Registers and unregisters a RendererMediaPlayerInterface object. |
116 virtual int RegisterMediaPlayer(RendererMediaPlayerInterface* player) = 0; | 113 virtual int RegisterMediaPlayer(RendererMediaPlayerInterface* player) = 0; |
117 virtual void UnregisterMediaPlayer(int player_id) = 0; | 114 virtual void UnregisterMediaPlayer(int player_id) = 0; |
118 }; | 115 }; |
119 | 116 |
120 } // namespace media | 117 } // namespace media |
121 | 118 |
122 #endif // MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_ | 119 #endif // MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_ |
OLD | NEW |