mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Use GeckoMedia and only that on platforms that support it
This commit is contained in:
parent
2374224cdf
commit
8e75c4d30e
1 changed files with 20 additions and 13 deletions
|
@ -870,22 +870,29 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
|
|||
self.media_element_load_algorithm();
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(target_os = "macos", target_os = "linux"),
|
||||
not(any(target_arch = "arm", target_arch = "aarch64")),
|
||||
))]
|
||||
// https://html.spec.whatwg.org/multipage/#dom-navigator-canplaytype
|
||||
fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult {
|
||||
#[cfg(all(
|
||||
any(target_os = "macos", target_os = "linux"),
|
||||
not(any(target_arch = "arm", target_arch = "aarch64"))))]
|
||||
{
|
||||
let gecko_media = match GeckoMedia::get() {
|
||||
Ok(gecko_media) => gecko_media,
|
||||
Err(_error) => return CanPlayTypeResult::_empty,
|
||||
};
|
||||
return match gecko_media.can_play_type(&type_) {
|
||||
CanPlayType::No => CanPlayTypeResult::_empty,
|
||||
CanPlayType::Maybe => CanPlayTypeResult::Maybe,
|
||||
CanPlayType::Probably => CanPlayTypeResult::Probably
|
||||
};
|
||||
let gecko_media = match GeckoMedia::get() {
|
||||
Ok(gecko_media) => gecko_media,
|
||||
Err(_) => return CanPlayTypeResult::_empty,
|
||||
};
|
||||
match gecko_media.can_play_type(&type_) {
|
||||
CanPlayType::No => CanPlayTypeResult::_empty,
|
||||
CanPlayType::Maybe => CanPlayTypeResult::Maybe,
|
||||
CanPlayType::Probably => CanPlayTypeResult::Probably
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(all(
|
||||
any(target_os = "macos", target_os = "linux"),
|
||||
not(any(target_arch = "arm", target_arch = "aarch64")),
|
||||
)))]
|
||||
// https://html.spec.whatwg.org/multipage/#dom-navigator-canplaytype
|
||||
fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult {
|
||||
match type_.parse::<Mime>() {
|
||||
Ok(Mime(TopLevel::Application, SubLevel::OctetStream, _)) |
|
||||
Err(_) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue