Skip to content

Commit

Permalink
⚡ improve video producer
Browse files Browse the repository at this point in the history
  • Loading branch information
chriamue committed Dec 30, 2023
1 parent ec66a23 commit f5eb557
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/wasm/video_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub fn video_producer(props: &VideoProducerProps) -> Html {
let canvas_ref_clone = canvas_ref.clone();
let frame_queue_producer = props.image_queue.clone();

use_effect(move || {
use_effect_with(frame_queue_producer.clone(), move |_| {
let video = video_ref_clone.cast::<HtmlVideoElement>().unwrap_throw();
let canvas = canvas_ref_clone.cast::<HtmlCanvasElement>().unwrap_throw();

Expand All @@ -106,8 +106,6 @@ pub fn video_producer(props: &VideoProducerProps) -> Html {
}
});

let video = video.clone();

let callback = Closure::wrap(Box::new(move || {
let frame_queue_producer = frame_queue_producer.clone();
producer_task(&video, &canvas, frame_queue_producer);
Expand Down

0 comments on commit f5eb557

Please sign in to comment.