LibWeb: Begin detecting the end of an HTMLMediaElement media resource

This commit is contained in:
Timothy Flynn 2023-04-10 20:04:46 -04:00 committed by Linus Groh
parent 33047b38ec
commit 4797f07883
Notes: sideshowbarker 2024-07-17 04:32:07 +09:00
4 changed files with 90 additions and 0 deletions

View file

@ -37,6 +37,11 @@ VideoTrack::VideoTrack(JS::Realm& realm, JS::NonnullGCPtr<HTMLMediaElement> medi
m_media_element->set_current_playback_position(playback_position_ms / 1000.0);
};
m_playback_manager->on_end_of_stream = [this]() {
auto playback_position_ms = static_cast<double>(duration().to_milliseconds());
m_media_element->set_current_playback_position(playback_position_ms / 1000.0);
};
m_playback_manager->on_decoder_error = [](auto) {
// FIXME: Propagate this error to HTMLMediaElement's error attribute.
};