Skip to content

[feat] Getting a URL to resources (assets, media, videos, files, etc) without loading the entire file into memory; streaming playback #4133

Description

@reivilibre

Describe the problem

I'd like to make an application that can play videos from the filesystem. In some cases, the videos might be larger than the available system memory, so we don't want to load them as a Uint8Array, Blob or anything like that.

My reading of the code first introduced in #2104 AFAICT and now living at https://github.com/tauri-apps/tauri/blob/3e702cf8b15762cdca43c8d7ff6f6e8ee9670244/core/tauri/src/manager.rs#L640-L651= suggests that, when using the asset:// protocol (e.g. through convertFileSrc) the entire file will be read into memory as a Vec<u8> upon request (unless there's a Range header, in which case it will read part of the file).

Describe the solution you'd like

Naïvely, I'd like the asset:// protocol to stream the file from disk rather than buffer it all into memory.

It doesn't have to be the asset protocol; any mechanism where the Rust backend can expose a single file on the filesystem and have it streamed into a video tag on the page would be sufficient for my needs.

Alternatives considered

A workaround might be to expose the file over HTTP and stream it using a http:// URI. This kind of entirely bypasses Tauri though?

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions