1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +00:00

LibWeb: Implement the HTMLMediaElement child <source> selection steps

Rather than setting the src attribute on the HTMLMediaElement, websites
may append a list of HTMLSourceElement nodes to the media element. There
is a series of "try the next source" steps to attempt to fetch/load each
source until we find one that works.
This commit is contained in:
Timothy Flynn 2023-05-12 15:02:37 -04:00 committed by Andreas Kling
parent 5bc386cc96
commit c161a0fc49
2 changed files with 217 additions and 59 deletions

View file

@ -26,6 +26,8 @@ enum class MediaSeekMode {
ApproximateForSpeed,
};
class SourceElementSelector;
class HTMLMediaElement : public HTMLElement {
WEB_PLATFORM_OBJECT(HTMLMediaElement, HTMLElement);
@ -101,6 +103,8 @@ protected:
virtual void on_seek(double, MediaSeekMode) { m_seek_in_progress = false; }
private:
friend SourceElementSelector;
struct EntireResource { };
using ByteRange = Variant<EntireResource>; // FIXME: This will need to include "until end" and an actual byte range.
@ -210,6 +214,8 @@ private:
JS::GCPtr<DOM::DocumentObserver> m_document_observer;
JS::GCPtr<SourceElementSelector> m_source_element_selector;
JS::GCPtr<Fetch::Infrastructure::FetchController> m_fetch_controller;
bool m_seek_in_progress = false;