mirror of
https://github.com/servo/servo.git
synced 2025-07-24 07:40:27 +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();
|
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
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-canplaytype
|
||||||
fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult {
|
fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult {
|
||||||
#[cfg(all(
|
let gecko_media = match GeckoMedia::get() {
|
||||||
any(target_os = "macos", target_os = "linux"),
|
Ok(gecko_media) => gecko_media,
|
||||||
not(any(target_arch = "arm", target_arch = "aarch64"))))]
|
Err(_) => return CanPlayTypeResult::_empty,
|
||||||
{
|
};
|
||||||
let gecko_media = match GeckoMedia::get() {
|
match gecko_media.can_play_type(&type_) {
|
||||||
Ok(gecko_media) => gecko_media,
|
CanPlayType::No => CanPlayTypeResult::_empty,
|
||||||
Err(_error) => return CanPlayTypeResult::_empty,
|
CanPlayType::Maybe => CanPlayTypeResult::Maybe,
|
||||||
};
|
CanPlayType::Probably => CanPlayTypeResult::Probably
|
||||||
return 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>() {
|
match type_.parse::<Mime>() {
|
||||||
Ok(Mime(TopLevel::Application, SubLevel::OctetStream, _)) |
|
Ok(Mime(TopLevel::Application, SubLevel::OctetStream, _)) |
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue