1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 19:17:44 +00:00

LibWeb+WebContent: Add APIs to control video playback state

This allows for the browser process to control the play/pause state,
whether we paint user agent controls on the video, and whether the video
loops when it finishes playing.
This commit is contained in:
Timothy Flynn 2023-05-15 11:17:58 -04:00 committed by Andreas Kling
parent d8f03dda08
commit c82f678fc6
9 changed files with 146 additions and 0 deletions

View file

@ -756,6 +756,21 @@ void ConnectionFromClient::prompt_closed(Optional<String> const& response)
m_page_host->prompt_closed(response);
}
void ConnectionFromClient::toggle_video_play_state()
{
m_page_host->toggle_video_play_state().release_value_but_fixme_should_propagate_errors();
}
void ConnectionFromClient::toggle_video_loop_state()
{
m_page_host->toggle_video_loop_state().release_value_but_fixme_should_propagate_errors();
}
void ConnectionFromClient::toggle_video_controls_state()
{
m_page_host->toggle_video_controls_state().release_value_but_fixme_should_propagate_errors();
}
void ConnectionFromClient::inspect_accessibility_tree()
{
if (auto* doc = page().top_level_browsing_context().active_document()) {

View file

@ -95,6 +95,10 @@ private:
virtual void confirm_closed(bool accepted) override;
virtual void prompt_closed(Optional<String> const& response) override;
virtual void toggle_video_play_state() override;
virtual void toggle_video_loop_state() override;
virtual void toggle_video_controls_state() override;
virtual Messages::WebContentServer::TakeDocumentScreenshotResponse take_document_screenshot() override;
virtual Messages::WebContentServer::GetLocalStorageEntriesResponse get_local_storage_entries() override;

View file

@ -334,6 +334,21 @@ void PageHost::prompt_closed(Optional<String> response)
page().prompt_closed(move(response));
}
Web::WebIDL::ExceptionOr<void> PageHost::toggle_video_play_state()
{
return page().toggle_video_play_state();
}
Web::WebIDL::ExceptionOr<void> PageHost::toggle_video_loop_state()
{
return page().toggle_video_loop_state();
}
Web::WebIDL::ExceptionOr<void> PageHost::toggle_video_controls_state()
{
return page().toggle_video_controls_state();
}
void PageHost::page_did_request_accept_dialog()
{
m_client.async_did_request_accept_dialog();

View file

@ -49,6 +49,10 @@ public:
void confirm_closed(bool accepted);
void prompt_closed(Optional<String> response);
Web::WebIDL::ExceptionOr<void> toggle_video_play_state();
Web::WebIDL::ExceptionOr<void> toggle_video_loop_state();
Web::WebIDL::ExceptionOr<void> toggle_video_controls_state();
[[nodiscard]] Gfx::Color background_color() const;
private:

View file

@ -76,4 +76,8 @@ endpoint WebContentServer
alert_closed() =|
confirm_closed(bool accepted) =|
prompt_closed(Optional<String> response) =|
toggle_video_play_state() =|
toggle_video_loop_state() =|
toggle_video_controls_state() =|
}