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

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

Issue 1567123002: Support CAST+WMPI on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fixes + comments addressed 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/media_blink.gyp ('k') | media/blink/webmediaplayer_cast_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
6 #define MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
7
8 // This file contains interfaces modeled after classes in
9 // content/renderer/media/android for the purposes of letting clases in
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
12 // is implemented: crbug/575276
13
14 #include <string>
15 #include "base/time/time.h"
16 #include "ui/gfx/geometry/rect_f.h"
17 #include "url/gurl.h"
18
19 // Dictates which type of media playback is being initialized.
20 enum MediaPlayerHostMsg_Initialize_Type {
21 MEDIA_PLAYER_TYPE_URL,
22 MEDIA_PLAYER_TYPE_MEDIA_SOURCE,
23 MEDIA_PLAYER_TYPE_REMOTE_ONLY,
24 MEDIA_PLAYER_TYPE_LAST = MEDIA_PLAYER_TYPE_REMOTE_ONLY
25 };
26
27 namespace media {
28
29 class RendererMediaPlayerInterface {
30 public:
31 virtual void OnMediaMetadataChanged(base::TimeDelta duration,
32 int width,
33 int height,
34 bool success) = 0;
35 virtual void OnPlaybackComplete() = 0;
36 virtual void OnBufferingUpdate(int percentage) = 0;
37 virtual void OnSeekRequest(const base::TimeDelta& time_to_seek) = 0;
38 virtual void OnSeekComplete(const base::TimeDelta& current_time) = 0;
39 virtual void OnMediaError(int error_type) = 0;
40 virtual void OnVideoSizeChanged(int width, int height) = 0;
41
42 // Called to update the current time.
43 virtual void OnTimeUpdate(base::TimeDelta current_timestamp,
44 base::TimeTicks current_time_ticks) = 0;
45
46 virtual void OnWaitingForDecryptionKey() = 0;
47 virtual void OnPlayerReleased() = 0;
48
49 // Functions called when media player status changes.
50 virtual void OnConnectedToRemoteDevice(
51 const std::string& remote_playback_message) = 0;
52 virtual void OnDisconnectedFromRemoteDevice() = 0;
53 virtual void OnDidExitFullscreen() = 0;
54 virtual void OnMediaPlayerPlay() = 0;
55 virtual void OnMediaPlayerPause() = 0;
56 virtual void OnRemoteRouteAvailabilityChanged(bool routes_available) = 0;
57
58 // Getters of playback state.
59 virtual bool paused() const = 0;
60
61 // True if the loaded media has a playable video track.
62 virtual bool hasVideo() const = 0;
63
64 // This function is called by the RendererMediaPlayerManager to pause the
65 // video and release the media player and surface texture when we switch tabs.
66 // However, the actual GlTexture is not released to keep the video screenshot.
67 virtual void SuspendAndReleaseResources() = 0;
68
69 #if defined(VIDEO_HOLE)
70 // Calculate the boundary rectangle of the media player (i.e. location and
71 // size of the video frame).
72 // Returns true if the geometry has been changed since the last call.
73 virtual bool UpdateBoundaryRectangle() = 0;
74
75 virtual const gfx::RectF GetBoundaryRectangle() = 0;
76 #endif
77 };
78
79 class RendererMediaPlayerManagerInterface {
80 public:
81 // Initializes a MediaPlayerAndroid object in browser process.
82 virtual void Initialize(MediaPlayerHostMsg_Initialize_Type type,
83 int player_id,
84 const GURL& url,
85 const GURL& first_party_for_cookies,
86 int demuxer_client_id,
87 const GURL& frame_url,
88 bool allow_credentials) = 0;
89
90 // Starts the player.
91 virtual void Start(int player_id) = 0;
92
93 // Pauses the player.
94 // is_media_related_action should be true if this pause is coming from an
95 // an action that explicitly pauses the video (user pressing pause, JS, etc.)
96 // Otherwise it should be false if Pause is being called due to other reasons
97 // (cleanup, freeing resources, etc.)
98 virtual void Pause(int player_id, bool is_media_related_action) = 0;
99
100 // Performs seek on the player.
101 virtual void Seek(int player_id, const base::TimeDelta& time) = 0;
102
103 // Sets the player volume.
104 virtual void SetVolume(int player_id, double volume) = 0;
105
106 // Sets the poster image.
107 virtual void SetPoster(int player_id, const GURL& poster) = 0;
108
109 // Releases resources for the player after being suspended.
110 virtual void SuspendAndReleaseResources(int player_id) = 0;
111
112 // Destroys the player in the browser process
113 virtual void DestroyPlayer(int player_id) = 0;
114
115 // Requests remote playback if possible
116 virtual void RequestRemotePlayback(int player_id) = 0;
117
118 // Requests control of remote playback
119 virtual void RequestRemotePlaybackControl(int player_id) = 0;
120
121 // Registers and unregisters a RendererMediaPlayerInterface object.
122 virtual int RegisterMediaPlayer(RendererMediaPlayerInterface* player) = 0;
123 virtual void UnregisterMediaPlayer(int player_id) = 0;
124 };
125
126 } // namespace media
127
128 #endif // MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
OLDNEW
« no previous file with comments | « media/blink/media_blink.gyp ('k') | media/blink/webmediaplayer_cast_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698