diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-06 15:21:41 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-06 15:21:41 -0500 |
commit | b143853814276e2cf6f6211bcd6e09877164aec4 (patch) | |
tree | b402794edf2d90c7eedb3f8eb5c08f188aac8606 /src/cmd/play.rs | |
parent | 480b9f9324bfcae611dd01ee8e793515e57c0e26 (diff) | |
download | teleterm-b143853814276e2cf6f6211bcd6e09877164aec4.tar.gz teleterm-b143853814276e2cf6f6211bcd6e09877164aec4.zip |
default to starting the player paused
this should make the help text for the keybindings more discoverable
Diffstat (limited to 'src/cmd/play.rs')
-rw-r--r-- | src/cmd/play.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cmd/play.rs b/src/cmd/play.rs index c6fec4b..cd78f36 100644 --- a/src/cmd/play.rs +++ b/src/cmd/play.rs @@ -28,6 +28,7 @@ impl crate::config::Config for Config { { Box::new(PlaySession::new( &self.ttyrec.filename, + self.play.play_at_start, self.play.playback_ratio, self.play.max_frame_length, )) @@ -106,18 +107,20 @@ struct Player { impl Player { fn new( + play_at_start: bool, playback_ratio: f32, max_frame_length: Option<std::time::Duration>, ) -> Self { + let now = std::time::Instant::now(); Self { playback_ratio, max_frame_length, ttyrec: Ttyrec::new(), idx: 0, timer: None, - base_time: std::time::Instant::now(), + base_time: now, played_amount: std::time::Duration::default(), - paused: None, + paused: if play_at_start { None } else { Some(now) }, } } @@ -268,6 +271,7 @@ struct PlaySession { impl PlaySession { fn new( filename: &str, + play_at_start: bool, playback_ratio: f32, max_frame_length: Option<std::time::Duration>, ) -> Self { @@ -275,7 +279,11 @@ impl PlaySession { file: FileState::Closed { filename: filename.to_string(), }, - player: Player::new(playback_ratio, max_frame_length), + player: Player::new( + play_at_start, + playback_ratio, + max_frame_length, + ), raw_screen: None, alternate_screen: None, key_reader: crate::key_reader::KeyReader::new(), |