🎥 Make videos programmatically with React
revert to previous strategy
Jonny Burger4b70f043b67d
diff --git a/packages/renderer/rust/opened_video.rs b/packages/renderer/rust/opened_video.rsindex e3aa0f7a5d..3da0bc4571 100644--- a/packages/renderer/rust/opened_video.rs+++ b/packages/renderer/rust/opened_video.rs@@ -57,26 +57,27 @@ impl OpenedVideo {pub fn get_frame(&mut self, time: f64) -> Result<Vec<u8>, PossibleErrors> {let position = (time as f64 * self.time_base.1 as f64 / self.time_base.0 as f64) as i64;let min_position =- ((time as f64 - 5.0) * self.time_base.1 as f64 / self.time_base.0 as f64) as i64;+ ((time as f64 - 1.0) * self.time_base.1 as f64 / self.time_base.0 as f64) as i64;let cache_item = self.frame_cache.get_item(position);if cache_item.is_some() {return Ok(cache_item.unwrap());}+ if position < self.last_seek || self.last_seek < min_position {+ _print_debug(&format!("Seeking to {} from {}", position, self.last_seek));+ self.input.seek(+ self.stream_index as i32,+ min_position,+ position,+ position,+ 0,+ )?;+ }+let mut bitmap: Vec<u8> = Vec::new();loop {- if (position - self.last_seek).abs() > (position - min_position).abs() {- _print_debug(&format!("Seeking to {} from {}", position, self.last_seek));- self.input.seek(- self.stream_index as i32,- min_position,- position,- position,- 0,- )?;- }let (stream, packet) = match self.input.get_next_packet() {Err(remotionffmpeg::Error::Eof) => {self.video.send_eof()?;