diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-05-07 13:57:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-07 13:57:46 -0400 |
commit | cd06c3450e12b3f4b135fa65b830c6605b61f286 (patch) | |
tree | 271ca65a2af061af5f2a235d8a52268e49bfea2f | |
parent | 90dfeab0f01544d41dc6b5cb99eeec804336b46e (diff) | |
parent | 5eb691c4d2916c490c0e5ed6cad013d5f788e972 (diff) | |
download | servo-cd06c3450e12b3f4b135fa65b830c6605b61f286.tar.gz servo-cd06c3450e12b3f4b135fa65b830c6605b61f286.zip |
Auto merge of #23229 - georgeroman:implement_htmlmediaelement_canplaytype, r=ferjm
Finish the implementation of the HTMLMediaElement canPlayType method
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22299
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23229)
<!-- Reviewable:end -->
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 21 | ||||
-rw-r--r-- | tests/wpt/metadata/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html.ini | 50 |
2 files changed, 10 insertions, 61 deletions
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 8d41a685b7b..cba16f17eed 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -62,7 +62,6 @@ use html5ever::{LocalName, Prefix}; use http::header::{self, HeaderMap, HeaderValue}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; -use mime::{self, Mime}; use net_traits::image::base::Image; use net_traits::image_cache::ImageResponse; use net_traits::request::{CredentialsMode, Destination, Referrer, RequestBuilder}; @@ -73,7 +72,7 @@ use servo_config::pref; use servo_media::player::context::{GlContext, NativeDisplay, PlayerGLContext}; use servo_media::player::frame::{Frame, FrameRenderer}; use servo_media::player::{PlaybackState, Player, PlayerError, PlayerEvent, StreamType}; -use servo_media::ServoMedia; +use servo_media::{ServoMedia, SupportsMediaType}; use servo_url::ServoUrl; use std::cell::Cell; use std::collections::VecDeque; @@ -1674,20 +1673,10 @@ impl HTMLMediaElementMethods for HTMLMediaElement { // https://html.spec.whatwg.org/multipage/#dom-navigator-canplaytype fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult { - match type_.parse::<Mime>() { - // XXX GStreamer is currently not very reliable playing OGG and most of - // the media related WPTs uses OGG if we report that we are able to - // play this type. So we report that we are unable to play it to force - // the usage of other types. - // https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/520 - Ok(ref mime) - if (mime.type_() == mime::APPLICATION && mime.subtype() == mime::OCTET_STREAM) || - (mime.subtype() == mime::OGG) => - { - CanPlayTypeResult::_empty - }, - Err(_) => CanPlayTypeResult::_empty, - _ => CanPlayTypeResult::Maybe, + match ServoMedia::get().unwrap().can_play_type(&type_) { + SupportsMediaType::No => CanPlayTypeResult::_empty, + SupportsMediaType::Maybe => CanPlayTypeResult::Maybe, + SupportsMediaType::Probably => CanPlayTypeResult::Probably, } } diff --git a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html.ini index bc63975b5c0..acc60d48f6a 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html.ini @@ -2,9 +2,6 @@ [video/mp4; codecs="mp4v.20.8" (optional)] expected: FAIL - [video/webm with bogus codec] - expected: FAIL - [video/3gpp; codecs="samr" (optional)] expected: FAIL @@ -14,16 +11,10 @@ [audio/webm (optional)] expected: FAIL - [audio/mp4; codecs="mp4a.40.2" (optional)] - expected: FAIL - - [audio/mp4 with bogus codec] + [audio/webm with and without codecs] expected: FAIL - [audio/webm; codecs="vorbis" (optional)] - expected: FAIL - - [video/webm; codecs="vp9" (optional)] + [audio/mp4; codecs="mp4a.40.2" (optional)] expected: FAIL [video/ogg; codecs="theora" (optional)] @@ -32,15 +23,6 @@ [video/mp4; codecs="avc1.64001E" (optional)] expected: FAIL - [video/ogg; codecs="opus" (optional)] - expected: FAIL - - [fictional formats and codecs not supported] - expected: FAIL - - [video/mp4 with bogus codec] - expected: FAIL - [video/mp4 (optional)] expected: FAIL @@ -50,10 +32,10 @@ [audio/ogg; codecs="opus" (optional)] expected: FAIL - [video/webm; codecs="vp8.0" (optional)] + [video/webm (optional)] expected: FAIL - [video/webm (optional)] + [video/webm with and without codecs] expected: FAIL [video/mp4; codecs="avc1.4D401E" (optional)] @@ -62,9 +44,6 @@ [audio/wav; codecs="1" (optional)] expected: FAIL - [video/3gpp with bogus codec] - expected: FAIL - [audio/wav (optional)] expected: FAIL @@ -80,9 +59,6 @@ [audio/mp4 (optional)] expected: FAIL - [video/webm; codecs="opus" (optional)] - expected: FAIL - [video/3gpp (optional)] expected: FAIL @@ -95,24 +71,8 @@ [audio/ogg; codecs="vorbis" (optional)] expected: FAIL - [audio/webm; codecs="opus" (optional)] - expected: FAIL - - [video/webm; codecs="vorbis" (optional)] - expected: FAIL - - [audio/wav with bogus codec] + [video/ogg; codecs="opus" (optional)] expected: FAIL [video/3gpp; codecs="mp4v.20.8" (optional)] expected: FAIL - - [video/webm; codecs="vp9.0" (optional)] - expected: FAIL - - [video/webm; codecs="vp8" (optional)] - expected: FAIL - - [audio/webm with bogus codec] - expected: FAIL - |