mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-24 18:42:09 +02:00
web/download: use shareFile or openFile depending on file size on ios
This commit is contained in:
parent
46942a36b3
commit
46c5e2e2b5
@ -106,6 +106,20 @@ export const downloadFile = ({ url, file, urlType }: DownloadFileParams) => {
|
||||
|
||||
try {
|
||||
if (file) {
|
||||
// 256mb cuz ram limit per tab is 384mb,
|
||||
// and other stuff (such as libav) might have used some ram too
|
||||
const iosFileShareSizeLimit = 1024 * 1024 * 256;
|
||||
|
||||
// this is required because we can't share big files
|
||||
// on ios due to a very low ram limit
|
||||
if (device.is.iOS) {
|
||||
if (file.size < iosFileShareSizeLimit) {
|
||||
return shareFile(file);
|
||||
} else {
|
||||
return openFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (pref === "share" && device.supports.share) {
|
||||
return shareFile(file);
|
||||
} else if (pref === "download") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user