OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "content/browser/media/android/browser_media_player_manager.h" | 5 #include "content/browser/media/android/browser_media_player_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/android/content_view_core_impl.h" | 8 #include "content/browser/android/content_view_core_impl.h" |
9 #include "content/browser/media/android/browser_demuxer_android.h" | 9 #include "content/browser/media/android/browser_demuxer_android.h" |
10 #include "content/browser/media/android/media_resource_getter_impl.h" | 10 #include "content/browser/media/android/media_resource_getter_impl.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); | 473 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); |
474 #endif // defined(VIDEO_HOLE) | 474 #endif // defined(VIDEO_HOLE) |
475 if (video_view_.get()) { | 475 if (video_view_.get()) { |
476 fullscreen_player_id_ = player_id; | 476 fullscreen_player_id_ = player_id; |
477 video_view_->OpenVideo(); | 477 video_view_->OpenVideo(); |
478 } else if (!ContentVideoView::GetInstance()) { | 478 } else if (!ContentVideoView::GetInstance()) { |
479 // In Android WebView, two ContentViewCores could both try to enter | 479 // In Android WebView, two ContentViewCores could both try to enter |
480 // fullscreen video, we just ignore the second one. | 480 // fullscreen video, we just ignore the second one. |
481 fullscreen_player_id_ = player_id; | 481 fullscreen_player_id_ = player_id; |
482 video_view_.reset(new ContentVideoView(this)); | 482 video_view_.reset(new ContentVideoView(this)); |
| 483 } else { |
| 484 // Force the second video to exit fullscreen. |
| 485 Send(new MediaPlayerMsg_DidEnterFullscreen(routing_id(), player_id)); |
| 486 Send(new MediaPlayerMsg_DidExitFullscreen(routing_id(), player_id)); |
483 } | 487 } |
484 } | 488 } |
485 | 489 |
486 void BrowserMediaPlayerManager::OnExitFullscreen(int player_id) { | 490 void BrowserMediaPlayerManager::OnExitFullscreen(int player_id) { |
487 if (fullscreen_player_id_ == player_id) { | 491 if (fullscreen_player_id_ == player_id) { |
488 MediaPlayerAndroid* player = GetPlayer(player_id); | 492 MediaPlayerAndroid* player = GetPlayer(player_id); |
489 if (player) | 493 if (player) |
490 player->SetVideoSurface(gfx::ScopedJavaSurface()); | 494 player->SetVideoSurface(gfx::ScopedJavaSurface()); |
491 video_view_->OnExitFullscreen(); | 495 video_view_->OnExitFullscreen(); |
492 } | 496 } |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 #if defined(VIDEO_HOLE) | 844 #if defined(VIDEO_HOLE) |
841 MediaPlayerAndroid* player = GetPlayer(player_id); | 845 MediaPlayerAndroid* player = GetPlayer(player_id); |
842 if (player && player->IsSurfaceInUse()) | 846 if (player && player->IsSurfaceInUse()) |
843 return; | 847 return; |
844 if (external_video_surface_container_) | 848 if (external_video_surface_container_) |
845 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); | 849 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); |
846 #endif // defined(VIDEO_HOLE) | 850 #endif // defined(VIDEO_HOLE) |
847 } | 851 } |
848 | 852 |
849 } // namespace content | 853 } // namespace content |
OLD | NEW |