Commit fdfc67c2 authored by François Beaufort's avatar François Beaufort Committed by Commit Bot

[Picture-in-Picture] Show last frame when video ends

This PR makes sure the last video frame stays visible in the PiP window
when video ends. This is what <video> elements currently do inline.

Bug: 910433
Change-Id: Id6a2065146ca4c76828f3257cd3ee2af7c2eed1b
Reviewed-on: https://chromium-review.googlesource.com/c/1356707Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613343}
parent 5067b69c
......@@ -822,7 +822,7 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
EXPECT_TRUE(in_picture_in_picture);
EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible());
EXPECT_FALSE(
EXPECT_TRUE(
window_controller()->GetWindowForTesting()->GetVideoLayer()->visible());
}
......
......@@ -404,9 +404,9 @@ void OverlayWindowViews::UpdateControlsVisibility(bool is_visible) {
#endif
GetControlsScrimLayer()->SetVisible(
(playback_state_ == kNoVideo) ? false : is_visible);
(playback_state_ == kEndOfVideo) ? false : is_visible);
GetControlsParentLayer()->SetVisible(
(playback_state_ == kNoVideo) ? false : is_visible);
(playback_state_ == kEndOfVideo) ? false : is_visible);
}
void OverlayWindowViews::UpdateControlsBounds() {
......@@ -623,19 +623,16 @@ void OverlayWindowViews::SetPlaybackState(PlaybackState playback_state) {
case kPlaying:
play_pause_controls_view_->SetToggled(true);
controls_parent_view_->SetVisible(true);
video_view_->SetVisible(true);
GetControlsParentLayer()->SetVisible(controls_parent_layer_visible);
break;
case kPaused:
play_pause_controls_view_->SetToggled(false);
controls_parent_view_->SetVisible(true);
video_view_->SetVisible(true);
GetControlsParentLayer()->SetVisible(controls_parent_layer_visible);
break;
case kNoVideo:
case kEndOfVideo:
controls_scrim_view_->SetVisible(false);
controls_parent_view_->SetVisible(false);
video_view_->SetVisible(false);
GetControlsParentLayer()->SetVisible(false);
break;
}
......
......@@ -163,7 +163,7 @@ class OverlayWindowViews : public content::OverlayWindow,
// Current playback state on the video in Picture-in-Picture window. It is
// used to show/hide controls.
PlaybackState playback_state_ = kNoVideo;
PlaybackState playback_state_ = kEndOfVideo;
// The upper and lower bounds of |current_size_|. These are determined by the
// size of the primary display work area when Picture-in-Picture is initiated.
......
......@@ -152,8 +152,7 @@ void PictureInPictureWindowControllerImpl::UpdatePlaybackState(
return;
if (reached_end_of_stream) {
media_player_id_.reset();
window_->SetPlaybackState(OverlayWindow::PlaybackState::kNoVideo);
window_->SetPlaybackState(OverlayWindow::PlaybackState::kEndOfVideo);
return;
}
......
......@@ -34,7 +34,7 @@ class OverlayWindow {
enum PlaybackState {
kPlaying = 0,
kPaused,
kNoVideo,
kEndOfVideo,
};
OverlayWindow() = default;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment