mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Update servo-media
This commit is contained in:
parent
4ac5b8a3ae
commit
5112e0435c
2 changed files with 36 additions and 30 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -3507,7 +3507,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo-media"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#35014baeb603b56b1b8b4de75919c58f7390cc30"
|
||||
source = "git+https://github.com/servo/media#c8cc491c850b18393586500233cc55e29800146c"
|
||||
dependencies = [
|
||||
"servo-media-audio 0.1.0 (git+https://github.com/servo/media)",
|
||||
"servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)",
|
||||
|
@ -3517,7 +3517,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo-media-audio"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#35014baeb603b56b1b8b4de75919c58f7390cc30"
|
||||
source = "git+https://github.com/servo/media#c8cc491c850b18393586500233cc55e29800146c"
|
||||
dependencies = [
|
||||
"boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byte-slice-cast 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3534,7 +3534,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo-media-gstreamer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#35014baeb603b56b1b8b4de75919c58f7390cc30"
|
||||
source = "git+https://github.com/servo/media#c8cc491c850b18393586500233cc55e29800146c"
|
||||
dependencies = [
|
||||
"byte-slice-cast 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3553,7 +3553,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo-media-player"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#35014baeb603b56b1b8b4de75919c58f7390cc30"
|
||||
source = "git+https://github.com/servo/media#c8cc491c850b18393586500233cc55e29800146c"
|
||||
dependencies = [
|
||||
"ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3640,7 +3640,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo_media_derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#35014baeb603b56b1b8b4de75919c58f7390cc30"
|
||||
source = "git+https://github.com/servo/media#c8cc491c850b18393586500233cc55e29800146c"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -1115,6 +1115,24 @@ impl HTMLMediaElement {
|
|||
|
||||
fn handle_player_event(&self, event: &PlayerEvent) {
|
||||
match *event {
|
||||
PlayerEvent::EndOfStream => {
|
||||
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
||||
// => "If the media data can be fetched but is found by inspection to be in
|
||||
// an unsupported format, or can otherwise not be rendered at all"
|
||||
if self.ready_state.get() < ReadyState::HaveMetadata {
|
||||
self.queue_dedicated_media_source_failure_steps();
|
||||
}
|
||||
},
|
||||
PlayerEvent::Error => {
|
||||
self.error.set(Some(&*MediaError::new(
|
||||
&*window_from_node(self),
|
||||
MEDIA_ERR_DECODE,
|
||||
)));
|
||||
self.upcast::<EventTarget>().fire_event(atom!("error"));
|
||||
},
|
||||
PlayerEvent::FrameUpdated => {
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
},
|
||||
PlayerEvent::MetadataUpdated(ref metadata) => {
|
||||
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
||||
// => "Once enough of the media data has been fetched to determine the duration..."
|
||||
|
@ -1179,6 +1197,12 @@ impl HTMLMediaElement {
|
|||
|
||||
// XXX Steps 12 and 13 require audio and video tracks support.
|
||||
},
|
||||
PlayerEvent::NeedData => {
|
||||
// XXX(ferjm) implement backoff protocol.
|
||||
},
|
||||
PlayerEvent::EnoughData => {
|
||||
// XXX(ferjm) implement backoff protocol.
|
||||
},
|
||||
PlayerEvent::PositionChanged(position) => {
|
||||
let position = position as f64;
|
||||
let _ = self
|
||||
|
@ -1188,25 +1212,6 @@ impl HTMLMediaElement {
|
|||
self.playback_position.set(position);
|
||||
self.time_marches_on();
|
||||
},
|
||||
PlayerEvent::StateChanged(ref state) => match *state {
|
||||
PlaybackState::Paused => {
|
||||
if self.ready_state.get() == ReadyState::HaveMetadata {
|
||||
self.change_ready_state(ReadyState::HaveEnoughData);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
PlayerEvent::EndOfStream => {
|
||||
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
||||
// => "If the media data can be fetched but is found by inspection to be in
|
||||
// an unsupported format, or can otherwise not be rendered at all"
|
||||
if self.ready_state.get() < ReadyState::HaveMetadata {
|
||||
self.queue_dedicated_media_source_failure_steps();
|
||||
}
|
||||
},
|
||||
PlayerEvent::FrameUpdated => {
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
},
|
||||
PlayerEvent::SeekData(p) => {
|
||||
self.fetch_request(Some(p));
|
||||
},
|
||||
|
@ -1221,12 +1226,13 @@ impl HTMLMediaElement {
|
|||
};
|
||||
ScriptThread::await_stable_state(Microtask::MediaElement(task));
|
||||
},
|
||||
PlayerEvent::Error => {
|
||||
self.error.set(Some(&*MediaError::new(
|
||||
&*window_from_node(self),
|
||||
MEDIA_ERR_DECODE,
|
||||
)));
|
||||
self.upcast::<EventTarget>().fire_event(atom!("error"));
|
||||
PlayerEvent::StateChanged(ref state) => match *state {
|
||||
PlaybackState::Paused => {
|
||||
if self.ready_state.get() == ReadyState::HaveMetadata {
|
||||
self.change_ready_state(ReadyState::HaveEnoughData);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue