1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #4728 from MBR-0001/subtitle-improvements-2

Add ability to upload hearing-impaired subs
This commit is contained in:
Bill Thornton 2023-09-27 12:54:57 -04:00 committed by GitHub
commit 4109b7eec6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 3 deletions

15
src/utils/file.ts Normal file
View file

@ -0,0 +1,15 @@
/**
* Reads and returns the file encoded in base64
*/
export function readFileAsBase64(file: File): Promise<string> {
return new Promise(function (resolve, reject) {
const reader = new FileReader();
reader.onload = (e) => {
// Split by a comma to remove the url: prefix
const data = (e.target?.result as string)?.split?.(',')[1];
resolve(data);
};
reader.onerror = reject;
reader.readAsDataURL(file);
});
}