1 // Copyright (c) 2012 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.
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_
8 #include "base/basictypes.h"
9 #include "base/time/time.h"
10 #include "media/base/android/demuxer_stream_player_params.h"
11 #include "media/base/media_export.h"
15 class MediaPlayerAndroid
;
16 class MediaResourceGetter
;
17 class MediaUrlInterceptor
;
19 // This class is responsible for managing active MediaPlayerAndroid objects.
20 class MEDIA_EXPORT MediaPlayerManager
{
22 virtual ~MediaPlayerManager() {}
24 // Returns a pointer to the MediaResourceGetter object.
25 virtual MediaResourceGetter
* GetMediaResourceGetter() = 0;
27 // Returns a pointer to the MediaUrlInterceptor object or null.
28 virtual MediaUrlInterceptor
* GetMediaUrlInterceptor() = 0;
30 // Called when time update messages need to be sent. Args: player ID,
31 // current timestamp, current time ticks.
32 virtual void OnTimeUpdate(int player_id
,
33 base::TimeDelta current_timestamp
,
34 base::TimeTicks current_time_ticks
) = 0;
36 // Called when media metadata changed. Args: player ID, duration of the
37 // media, width, height, whether the metadata is successfully extracted.
38 virtual void OnMediaMetadataChanged(
40 base::TimeDelta duration
,
45 // Called when playback completed. Args: player ID.
46 virtual void OnPlaybackComplete(int player_id
) = 0;
48 // Called when media download was interrupted. Args: player ID.
49 virtual void OnMediaInterrupted(int player_id
) = 0;
51 // Called when buffering has changed. Args: player ID, percentage
53 virtual void OnBufferingUpdate(int player_id
, int percentage
) = 0;
55 // Called when seek completed. Args: player ID, current time.
56 virtual void OnSeekComplete(
58 const base::TimeDelta
& current_time
) = 0;
60 // Called when error happens. Args: player ID, error type.
61 virtual void OnError(int player_id
, int error
) = 0;
63 // Called when video size has changed. Args: player ID, width, height.
64 virtual void OnVideoSizeChanged(int player_id
, int width
, int height
) = 0;
66 // Called when the player thinks it stopped or started making sound.
67 virtual void OnAudibleStateChanged(int player_id
, bool is_audible_now
) = 0;
69 // Called when the player pauses as a new key is required to decrypt
71 virtual void OnWaitingForDecryptionKey(int player_id
) = 0;
73 // Returns the player that's in the fullscreen mode currently.
74 virtual MediaPlayerAndroid
* GetFullscreenPlayer() = 0;
76 // Returns the player with the specified id.
77 virtual MediaPlayerAndroid
* GetPlayer(int player_id
) = 0;
79 // Called by the player to get a hardware protected surface.
80 virtual void RequestFullScreen(int player_id
) = 0;
82 #if defined(VIDEO_HOLE)
83 // Returns true if a media player should use video-overlay for the embedded
85 virtual bool ShouldUseVideoOverlayForEmbeddedEncryptedVideo() = 0;
86 #endif // defined(VIDEO_HOLE)
91 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_