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); |
105 | 106 |
106 MediaPlayerManager* manager() { return manager_; } | 107 MediaPlayerManager* manager() { return manager_; } |
107 | 108 |
108 RequestMediaResourcesCB request_media_resources_cb_; | 109 RequestMediaResourcesCB request_media_resources_cb_; |
109 | 110 |
110 private: | 111 private: |
111 friend class MediaPlayerListener; | 112 friend class MediaPlayerListener; |
112 | 113 |
113 // Player ID assigned to this player. | 114 // Player ID assigned to this player. |
114 int player_id_; | 115 int player_id_; |
115 | 116 |
116 // Resource manager for all the media players. | 117 // Resource manager for all the media players. |
117 MediaPlayerManager* manager_; | 118 MediaPlayerManager* manager_; |
118 | 119 |
119 // Url for the frame that contains this player. | 120 // Url for the frame that contains this player. |
120 GURL frame_url_; | 121 GURL frame_url_; |
121 | 122 |
122 // Listener object that listens to all the media player events. | 123 // Listener object that listens to all the media player events. |
123 scoped_ptr<MediaPlayerListener> listener_; | 124 scoped_ptr<MediaPlayerListener> listener_; |
124 | 125 |
| 126 // Maintains the audible state of the player, true if it is playing sound. |
| 127 bool is_audible_; |
| 128 |
125 // Weak pointer passed to |listener_| for callbacks. | 129 // Weak pointer passed to |listener_| for callbacks. |
126 // NOTE: Weak pointers must be invalidated before all other member variables. | 130 // NOTE: Weak pointers must be invalidated before all other member variables. |
127 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; | 131 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; |
128 | 132 |
129 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 133 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
130 }; | 134 }; |
131 | 135 |
132 } // namespace media | 136 } // namespace media |
133 | 137 |
134 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 138 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
OLD | NEW |