gleetube/media
Types
Media data for upload operations.
pub type Media {
Media(data: BitArray, mimetype: String, chunk_size: Int)
}
Constructors
-
Media(data: BitArray, mimetype: String, chunk_size: Int)
Progress of a media upload.
pub type MediaUploadProgress {
MediaUploadProgress(bytes_sent: Int, total_size: Int)
}
Constructors
-
MediaUploadProgress(bytes_sent: Int, total_size: Int)
Values
pub const default_chunk_size: Int
Default chunk size for resumable uploads (20 MB).
pub fn from_string(data: String, mimetype: String) -> Media
Create a Media from a UTF-8 string (useful for caption files).
pub fn get_chunk(media: Media, offset: Int) -> BitArray
Extract a chunk of data starting at the given byte offset. Returns the chunk and its actual size (may be smaller than chunk_size at end of data).
pub fn new(data: BitArray, mimetype: String) -> Media
Create a new Media from raw binary data and MIME type.
pub fn progress(p: MediaUploadProgress) -> Float
Get the upload progress as a float between 0.0 and 1.0.