aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlmediaelement.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-05-07 13:57:46 -0400
committerGitHub <noreply@github.com>2019-05-07 13:57:46 -0400
commitcd06c3450e12b3f4b135fa65b830c6605b61f286 (patch)
tree271ca65a2af061af5f2a235d8a52268e49bfea2f /components/script/dom/htmlmediaelement.rs
parent90dfeab0f01544d41dc6b5cb99eeec804336b46e (diff)
parent5eb691c4d2916c490c0e5ed6cad013d5f788e972 (diff)
downloadservo-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 -->
Diffstat (limited to 'components/script/dom/htmlmediaelement.rs')
-rw-r--r--components/script/dom/htmlmediaelement.rs21
1 files changed, 5 insertions, 16 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,
}
}