File tree Expand file tree Collapse file tree 6 files changed +11
-11
lines changed
Expand file tree Collapse file tree 6 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -581,15 +581,15 @@ impl GStreamerPlayer {
581581 let observer = self . observer . clone ( ) ;
582582 // Handle `position-update` signal.
583583 signal_adapter. connect_position_updated ( move |_, position| {
584- if let Some ( seconds) = position. map ( |p| p. seconds ( ) ) {
584+ if let Some ( seconds) = position. map ( |p| p. seconds_f64 ( ) ) {
585585 let _ = notify ! ( observer, PlayerEvent :: PositionChanged ( seconds) ) ;
586586 }
587587 } ) ;
588588
589589 let observer = self . observer . clone ( ) ;
590590 // Handle `seek-done` signal.
591591 signal_adapter. connect_seek_done ( move |_, position| {
592- let _ = notify ! ( observer, PlayerEvent :: SeekDone ( position. seconds ( ) ) ) ;
592+ let _ = notify ! ( observer, PlayerEvent :: SeekDone ( position. seconds_f64 ( ) ) ) ;
593593 } ) ;
594594
595595 // Handle `media-info-updated` signal.
Original file line number Diff line number Diff line change @@ -107,11 +107,11 @@ fn run_example(servo_media: Arc<ServoMedia>) {
107107 } ,
108108 PlayerEvent :: VideoFrameUpdated => eprint ! ( "." ) ,
109109 PlayerEvent :: PositionChanged ( p) => {
110- if p == 2 && !muted {
110+ if p as u64 == 2 && !muted {
111111 println ! ( "\n Position is at 2sec, muting, 1 second of silence incoming" ) ;
112112 servo_media. mute ( & context_id, true ) ;
113113 muted = true ;
114- } else if p == 3 && muted {
114+ } else if p as u64 == 3 && muted {
115115 println ! ( "\n Position is at 3sec, unmuting" ) ;
116116 servo_media. mute ( & context_id, false ) ;
117117 muted = false ;
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ fn run_example(servo_media: Arc<ServoMedia>) {
6262 } ,
6363 PlayerEvent :: VideoFrameUpdated => eprint ! ( "." ) ,
6464 PlayerEvent :: PositionChanged ( p) => {
65- if p == 4 {
65+ if p as u64 == 4 {
6666 break ;
6767 }
6868 println ! ( "Position changed {:?}" , p)
Original file line number Diff line number Diff line change @@ -437,7 +437,7 @@ pub fn main_loop(mut app: App) -> Result<glutin::WindowedContext<glutin::Possibl
437437 }
438438 } ,
439439 player:: PlayerEvent :: VideoFrameUpdated => frameupdated = true ,
440- player:: PlayerEvent :: PositionChanged ( pos) => playerstate. pos = pos as f64 ,
440+ player:: PlayerEvent :: PositionChanged ( pos) => playerstate. pos = pos,
441441 _ => ( ) ,
442442 }
443443 }
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ fn run_example(servo_media: Arc<ServoMedia>) {
141141 PlayerEvent :: VideoFrameUpdated => eprint ! ( "." ) ,
142142 PlayerEvent :: PositionChanged ( p) => {
143143 let player = player. lock ( ) . unwrap ( ) ;
144- if p == 4 && !seek_requested {
144+ if p as u64 == 4 && !seek_requested {
145145 println ! ( "\n Position changed to 4sec, seeking back to 0sec" ) ;
146146 if let Err ( e) = player. seek ( 0. ) {
147147 eprintln ! ( "{:?}" , e) ;
Original file line number Diff line number Diff line change @@ -69,15 +69,15 @@ pub enum PlayerEvent {
6969 /// The internal player queue is running out of data. The client should start
7070 /// pushing more data.
7171 NeedData ,
72- PositionChanged ( u64 ) ,
73- /// The player needs the data to perform a seek to the given offset.
72+ PositionChanged ( f64 ) ,
73+ /// The player needs the data to perform a seek to the given offset in bytes .
7474 /// The next push_data should get the buffers from the new offset.
7575 /// The player will be blocked until the user unlocks it through
7676 /// the given SeekLock instance.
7777 /// This event is only received for seekable stream types.
7878 SeekData ( u64 , SeekLock ) ,
79- /// The player has performed a seek to the given offset.
80- SeekDone ( u64 ) ,
79+ /// The player has performed a seek to the given time offset in seconds .
80+ SeekDone ( f64 ) ,
8181 StateChanged ( PlaybackState ) ,
8282}
8383
You can’t perform that action at this time.
0 commit comments