diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2018-12-17 23:50:39 +0100 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-01-17 10:01:38 +0100 |
commit | f5581a78ab5a2581922a719f54037ca2577ed1ad (patch) | |
tree | dc17f5bb92c16a0536d7b1eb20b33482a2c7081e /components/script/dom/htmlmediaelement.rs | |
parent | c558db97372ce4bafe2bd74a0b42bbfedff752bd (diff) | |
download | servo-f5581a78ab5a2581922a719f54037ca2577ed1ad.tar.gz servo-f5581a78ab5a2581922a719f54037ca2577ed1ad.zip |
Add media cache and implement HTMLMediaElement.buffering
Diffstat (limited to 'components/script/dom/htmlmediaelement.rs')
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index b38c0e9255f..6faa718a0a9 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -1657,6 +1657,17 @@ impl HTMLMediaElementMethods for HTMLMediaElement { TimeRanges::new(self.global().as_window(), self.played.clone()) } + // https://html.spec.whatwg.org/multipage/#dom-media-buffered + fn Buffered(&self) -> DomRoot<TimeRanges> { + let mut buffered = TimeRangesContainer::new(); + if let Ok(ranges) = self.player.buffered() { + for range in ranges { + let _ = buffered.add(range.start as f64, range.end as f64); + } + } + TimeRanges::new(self.global().as_window(), Rc::new(DomRefCell::new(buffered))) + } + // https://html.spec.whatwg.org/multipage/#dom-media-texttracks fn TextTracks(&self) -> DomRoot<TextTrackList> { let window = window_from_node(self); |