diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 9a38807e510..f94048c47de 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -130,7 +130,7 @@ use style::values::specified::Length; use tendril::fmt::UTF8; use tendril::stream::LossyDecoder; use tendril::{StrTendril, TendrilSink}; -use time::Duration; +use time::{Duration, Timespec}; use uuid::Uuid; use webrender_api::{DocumentId, ImageKey, RenderApiSender}; use webvr_traits::WebVRGamepadHand; @@ -488,6 +488,7 @@ unsafe_no_jsmanaged_fields!(dyn Player); unsafe_no_jsmanaged_fields!(Mutex); unsafe_no_jsmanaged_fields!(RenderApiSender); unsafe_no_jsmanaged_fields!(ResourceFetchTiming); +unsafe_no_jsmanaged_fields!(Timespec); unsafe impl<'a> JSTraceable for &'a str { #[inline] diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 880ba8ea49c..b751e176fb4 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -204,6 +204,9 @@ pub struct HTMLMediaElement { text_tracks_list: MutNullableDom, /// Expected content length of the media asset being fetched or played. content_length: Cell>, + /// Time of last timeupdate notification. + #[ignore_malloc_size_of = "Defined in time"] + next_timeupdate_event: Cell, } /// @@ -261,6 +264,7 @@ impl HTMLMediaElement { played: Rc::new(DomRefCell::new(TimeRangesContainer::new())), text_tracks_list: Default::default(), content_length: Cell::new(None), + next_timeupdate_event: Cell::new(time::get_time() + Duration::milliseconds(250)), } } @@ -303,7 +307,16 @@ impl HTMLMediaElement { /// https://html.spec.whatwg.org/multipage/#time-marches-on fn time_marches_on(&self) { - // TODO: implement this. + // Step 6. + if time::get_time() > self.next_timeupdate_event.get() { + let window = window_from_node(self); + window + .task_manager() + .media_element_task_source() + .queue_simple_event(self.upcast(), atom!("timeupdate"), &window); + self.next_timeupdate_event + .set(time::get_time() + Duration::milliseconds(350)); + } } /// @@ -1173,6 +1186,7 @@ impl HTMLMediaElement { .borrow_mut() .add(self.playback_position.get(), position); self.playback_position.set(position); + self.time_marches_on(); }, PlayerEvent::StateChanged(ref state) => match *state { PlaybackState::Paused => { @@ -1270,8 +1284,14 @@ impl HTMLMediaElementMethods for HTMLMediaElement { // https://html.spec.whatwg.org/multipage/#dom-navigator-canplaytype fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult { match type_.parse::() { + // 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) => + if (mime.type_() == mime::APPLICATION && mime.subtype() == mime::OCTET_STREAM) || + (mime.subtype() == mime::OGG) => { CanPlayTypeResult::_empty }, diff --git a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/audio_loop_base.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/audio_loop_base.html.ini index 7d57f0e066e..c6977a66f6d 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/audio_loop_base.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/audio_loop_base.html.ini @@ -1,6 +1,5 @@ [audio_loop_base.html] - type: testharness - disabled: extreme timeout + expected: TIMEOUT [Check if audio.loop is set to true that expecting the seeking event is fired more than once] - expected: FAIL + expected: NOTRUN diff --git a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/audio_volume_check.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/audio_volume_check.html.ini deleted file mode 100644 index 874b91c99d4..00000000000 --- a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/audio_volume_check.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[audio_volume_check.html] - type: testharness - [Check if media.volume is set to new value less than 0.0 that expecting an IndexSizeError exception is to be thrown] - expected: PASS - - [Check if audio.volume is set to new value greater than 1.0 that expecting an IndexSizeError exception is to be thrown] - expected: PASS - diff --git a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/autoplay-with-broken-track.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/autoplay-with-broken-track.html.ini deleted file mode 100644 index 28ebc56f4dc..00000000000 --- a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/autoplay-with-broken-track.html.ini +++ /dev/null @@ -1,13 +0,0 @@ -[autoplay-with-broken-track.html] - expected: TIMEOUT - [