OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 virtual void OnPlaybackComplete(); | 95 virtual void OnPlaybackComplete(); |
96 virtual void OnMediaInterrupted(); | 96 virtual void OnMediaInterrupted(); |
97 virtual void OnSeekComplete(); | 97 virtual void OnSeekComplete(); |
98 virtual void OnMediaPrepared(); | 98 virtual void OnMediaPrepared(); |
99 | 99 |
100 // Attach/Detaches |listener_| for listening to all the media events. If | 100 // Attach/Detaches |listener_| for listening to all the media events. If |
101 // |j_media_player| is NULL, |listener_| only listens to the system media | 101 // |j_media_player| is NULL, |listener_| only listens to the system media |
102 // events. Otherwise, it also listens to the events from |j_media_player|. | 102 // events. Otherwise, it also listens to the events from |j_media_player|. |
103 void AttachListener(jobject j_media_player); | 103 void AttachListener(jobject j_media_player); |
104 void DetachListener(); | 104 void DetachListener(); |
105 void SetAudible(bool is_audible); | |
106 | 105 |
107 MediaPlayerManager* manager() { return manager_; } | 106 MediaPlayerManager* manager() { return manager_; } |
108 | 107 |
109 RequestMediaResourcesCB request_media_resources_cb_; | 108 RequestMediaResourcesCB request_media_resources_cb_; |
110 | 109 |
111 private: | 110 private: |
112 friend class MediaPlayerListener; | 111 friend class MediaPlayerListener; |
113 | 112 |
114 // Player ID assigned to this player. | 113 // Player ID assigned to this player. |
115 int player_id_; | 114 int player_id_; |
116 | 115 |
117 // Resource manager for all the media players. | 116 // Resource manager for all the media players. |
118 MediaPlayerManager* manager_; | 117 MediaPlayerManager* manager_; |
119 | 118 |
120 // Url for the frame that contains this player. | 119 // Url for the frame that contains this player. |
121 GURL frame_url_; | 120 GURL frame_url_; |
122 | 121 |
123 // Listener object that listens to all the media player events. | 122 // Listener object that listens to all the media player events. |
124 scoped_ptr<MediaPlayerListener> listener_; | 123 scoped_ptr<MediaPlayerListener> listener_; |
125 | 124 |
126 // Maintains the audible state of the player, true if it is playing sound. | |
127 bool is_audible_; | |
128 | |
129 // Weak pointer passed to |listener_| for callbacks. | 125 // Weak pointer passed to |listener_| for callbacks. |
130 // NOTE: Weak pointers must be invalidated before all other member variables. | 126 // NOTE: Weak pointers must be invalidated before all other member variables. |
131 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; | 127 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; |
132 | 128 |
133 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 129 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
134 }; | 130 }; |
135 | 131 |
136 } // namespace media | 132 } // namespace media |
137 | 133 |
138 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 134 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
OLD | NEW |