mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 06:02:51 +00:00
LibWeb: Partially implement MediaSource.isTypeSupported()
This commit is contained in:
parent
0adf261c32
commit
24069d55bf
Notes:
github-actions[bot]
2024-11-26 22:51:58 +00:00
Author: https://github.com/gmta
Commit: 24069d55bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2588
Reviewed-by: https://github.com/shannonbooth
5 changed files with 200 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/Bindings/MediaSourcePrototype.h>
|
||||
#include <LibWeb/MediaSourceExtensions/EventNames.h>
|
||||
#include <LibWeb/MediaSourceExtensions/MediaSource.h>
|
||||
#include <LibWeb/MimeSniff/MimeType.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
|
@ -67,4 +68,28 @@ GC::Ptr<WebIDL::CallbackType> MediaSource::onsourceclose()
|
|||
return event_handler_attribute(EventNames::sourceclose);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-mediasource-istypesupported
|
||||
bool MediaSource::is_type_supported(JS::VM&, String const& type)
|
||||
{
|
||||
// 1. If type is an empty string, then return false.
|
||||
if (type.is_empty())
|
||||
return false;
|
||||
|
||||
// 2. If type does not contain a valid MIME type string, then return false.
|
||||
auto mime_type = MimeSniff::MimeType::parse(type);
|
||||
if (!mime_type.has_value())
|
||||
return false;
|
||||
|
||||
// FIXME: 3. If type contains a media type or media subtype that the MediaSource does not support, then
|
||||
// return false.
|
||||
|
||||
// FIXME: 4. If type contains a codec that the MediaSource does not support, then return false.
|
||||
|
||||
// FIXME: 5. If the MediaSource does not support the specified combination of media type, media
|
||||
// subtype, and codecs then return false.
|
||||
|
||||
// 6. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue