OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "content/browser/android/media_player_manager_android.h" | 5 #include "content/browser/android/media_player_manager_android.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/android/cookie_getter_impl.h" | 8 #include "content/browser/android/cookie_getter_impl.h" |
9 #include "content/common/media/media_player_messages.h" | 9 #include "content/common/media/media_player_messages.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 base::Unretained(this)), | 116 base::Unretained(this)), |
117 base::Bind(&MediaPlayerManagerAndroid::OnBufferingUpdate, | 117 base::Bind(&MediaPlayerManagerAndroid::OnBufferingUpdate, |
118 base::Unretained(this)), | 118 base::Unretained(this)), |
119 base::Bind(&MediaPlayerManagerAndroid::OnPrepared, | 119 base::Bind(&MediaPlayerManagerAndroid::OnPrepared, |
120 base::Unretained(this)), | 120 base::Unretained(this)), |
121 base::Bind(&MediaPlayerManagerAndroid::OnPlaybackComplete, | 121 base::Bind(&MediaPlayerManagerAndroid::OnPlaybackComplete, |
122 base::Unretained(this)), | 122 base::Unretained(this)), |
123 base::Bind(&MediaPlayerManagerAndroid::OnSeekComplete, | 123 base::Bind(&MediaPlayerManagerAndroid::OnSeekComplete, |
124 base::Unretained(this)), | 124 base::Unretained(this)), |
125 base::Bind(&MediaPlayerManagerAndroid::OnTimeUpdate, | 125 base::Bind(&MediaPlayerManagerAndroid::OnTimeUpdate, |
126 base::Unretained(this)), | |
127 base::Bind(&MediaPlayerManagerAndroid::OnMediaInterrupted, | |
126 base::Unretained(this)))); | 128 base::Unretained(this)))); |
127 | 129 |
128 // Send a MediaPrepared message to webkit so that Load() can finish. | 130 // Send a MediaPrepared message to webkit so that Load() can finish. |
129 Send(new MediaPlayerMsg_MediaPrepared( | 131 Send(new MediaPlayerMsg_MediaPrepared( |
130 routing_id(), player_id, GetPlayer(player_id)->GetDuration())); | 132 routing_id(), player_id, GetPlayer(player_id)->GetDuration())); |
131 } | 133 } |
132 | 134 |
133 void MediaPlayerManagerAndroid::OnStart(int player_id) { | 135 void MediaPlayerManagerAndroid::OnStart(int player_id) { |
134 MediaPlayerBridge* player = GetPlayer(player_id); | 136 MediaPlayerBridge* player = GetPlayer(player_id); |
135 if (player) | 137 if (player) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 if (fullscreen_player_id_ != -1) | 215 if (fullscreen_player_id_ != -1) |
214 video_view_.UpdateMediaMetadata(); | 216 video_view_.UpdateMediaMetadata(); |
215 } | 217 } |
216 | 218 |
217 void MediaPlayerManagerAndroid::OnPlaybackComplete(int player_id) { | 219 void MediaPlayerManagerAndroid::OnPlaybackComplete(int player_id) { |
218 Send(new MediaPlayerMsg_MediaPlaybackCompleted(routing_id(), player_id)); | 220 Send(new MediaPlayerMsg_MediaPlaybackCompleted(routing_id(), player_id)); |
219 if (fullscreen_player_id_ != -1) | 221 if (fullscreen_player_id_ != -1) |
220 video_view_.OnPlaybackComplete(); | 222 video_view_.OnPlaybackComplete(); |
221 } | 223 } |
222 | 224 |
225 void MediaPlayerManagerAndroid::OnMediaInterrupted(int player_id) { | |
226 // Tell WebKit that the audio should be paused, then release all resources | |
227 Send(new MediaPlayerMsg_DidMediaPlayerPause(routing_id(), player_id)); | |
Yaron
2012/11/27 05:58:00
Have you tested fullscreen? FullscreenPlayerPause
Miguel Garcia
2012/11/27 17:24:06
Yes, played something in full screen mode and call
| |
228 OnReleaseResources(player_id); | |
229 } | |
230 | |
223 void MediaPlayerManagerAndroid::OnBufferingUpdate( | 231 void MediaPlayerManagerAndroid::OnBufferingUpdate( |
224 int player_id, int percentage) { | 232 int player_id, int percentage) { |
225 Send(new MediaPlayerMsg_MediaBufferingUpdate( | 233 Send(new MediaPlayerMsg_MediaBufferingUpdate( |
226 routing_id(), player_id, percentage)); | 234 routing_id(), player_id, percentage)); |
227 if (fullscreen_player_id_ != -1) | 235 if (fullscreen_player_id_ != -1) |
228 video_view_.OnBufferingUpdate(percentage); | 236 video_view_.OnBufferingUpdate(percentage); |
229 } | 237 } |
230 | 238 |
231 void MediaPlayerManagerAndroid::OnSeekComplete(int player_id, | 239 void MediaPlayerManagerAndroid::OnSeekComplete(int player_id, |
232 base::TimeDelta current_time) { | 240 base::TimeDelta current_time) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 } | 293 } |
286 } | 294 } |
287 } | 295 } |
288 | 296 |
289 void MediaPlayerManagerAndroid::ReleaseMediaResources( | 297 void MediaPlayerManagerAndroid::ReleaseMediaResources( |
290 MediaPlayerBridge* player) { | 298 MediaPlayerBridge* player) { |
291 // Nothing needs to be done. | 299 // Nothing needs to be done. |
292 } | 300 } |
293 | 301 |
294 } // namespace content | 302 } // namespace content |
OLD | NEW |