mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibMedia+LibWeb: Add an initial Starting state to PlaybackManager
This state will indicate to the media element that it's not guaranteed to have a frame yet, for the purposes of determining the ready state. JavaScript should be sure that video elements with a ready state of HAVE_CURRENT_DATA or greater represent the current video frame already. To allow the state to be exited if audio is disabled, audio tracks are now only added to the buffering set on enable if the audio sink exists, since without the sink starting the data provider, it will never be removed. This is a step towards making video ref tests.
This commit is contained in:
committed by
Gregory Bertilson
parent
e1e752cc28
commit
08faa83340
Notes:
github-actions[bot]
2026-04-22 00:13:12 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/08faa83340f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9004
@@ -1743,7 +1743,9 @@ void HTMLMediaElement::on_metadata_parsed()
|
||||
});
|
||||
}
|
||||
|
||||
// AD-HOC: If we've already got buffered data, we need to upgrade the readyState further than HAVE_METADATA.
|
||||
// AD-HOC: Now that we've enabled one of each available track type, the playback manager can be started. If this
|
||||
// causes the playback manager to exit the initial state, the ready state should change.
|
||||
m_playback_manager->start();
|
||||
update_ready_state();
|
||||
}
|
||||
|
||||
@@ -2127,7 +2129,8 @@ void HTMLMediaElement::update_ready_state()
|
||||
auto current_range = ranges.range_at_or_after(current_time);
|
||||
auto available_data = m_playback_manager->available_data();
|
||||
|
||||
if (available_data == Media::AvailableData::Current && !current_range.has_value()) {
|
||||
if (available_data == Media::AvailableData::None
|
||||
|| (available_data == Media::AvailableData::Current && !current_range.has_value())) {
|
||||
// 1. Set the HTMLMediaElement's readyState attribute to HAVE_METADATA.
|
||||
set_ready_state(ReadyState::HaveMetadata);
|
||||
// 2. Abort these steps.
|
||||
|
||||
Reference in New Issue
Block a user