I get the image on the client from my MacBook Pro camera. I send the bytes to the Rust server, then I send the bytes to Tauri React using the event:
app_handle.emit_all(“event-server-data”, video_base64).unwrap();
On the Tauri React side:
const [videoData, setVideoData] = useState<string>("");
useEffect(() => {
const unlistenAddMarker = listen<string>('event-server-data', (event) => {
setVideoData(event.payload)
});
return () => {
unlistenAddMarker.then(f => f());
};
}, []);
return (
<div className="container">
<h1>Welcome to Tauri!</h1>
{videoData && (
<img src={`data:image/jpeg;base64,${videoData}`}/>
// <video controls>
// <source src={`data:video/mp4;base64,${videoData}`} type="video/mp4" />
// Your browser does not support the video tag.
// </video>
)}
...
I can see the image.
I send frames every 16 milliseconds.
But it's really putting a lot of strain on my mac. I think this is very unoptimized and wrong approach. It also increases memory consumption.
How do I properly transfer a large amount of information (In this case it is uncompressed footage from my MacBook Pro camera)?
Or is Tauri not suitable for this? Or is Tauri more suitable for small amounts of data that are not transferred that often?
Thanks for your reply.