mirror of
https://github.com/alangrainger/immich-public-proxy.git
synced 2024-12-28 03:41:58 +00:00
#25 Fix video files not playing on iOS
This commit is contained in:
parent
6dc0df93b4
commit
9c99beaf9b
2 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "immich-public-proxy",
|
"name": "immich-public-proxy",
|
||||||
"version": "1.5.1",
|
"version": "1.5.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "ts-node src/index.ts",
|
"dev": "ts-node src/index.ts",
|
||||||
"build": "npx tsc",
|
"build": "npx tsc",
|
||||||
|
|
|
@ -39,7 +39,8 @@ class Render {
|
||||||
if (asset.type === AssetType.video) {
|
if (asset.type === AssetType.video) {
|
||||||
const range = (req.range || '').replace(/bytes=/, '').split('-')
|
const range = (req.range || '').replace(/bytes=/, '').split('-')
|
||||||
const start = parseInt(range[0], 10) || 0
|
const start = parseInt(range[0], 10) || 0
|
||||||
headers.range = `bytes=${start}-${start + 2499999}`
|
const end = parseInt(range[1], 10) || start + 2499999
|
||||||
|
headers.range = `bytes=${start}-${end}`
|
||||||
headerList.push('cache-control', 'content-range')
|
headerList.push('cache-control', 'content-range')
|
||||||
res.setHeader('accept-ranges', 'bytes')
|
res.setHeader('accept-ranges', 'bytes')
|
||||||
res.status(206) // Partial Content
|
res.status(206) // Partial Content
|
||||||
|
@ -98,8 +99,8 @@ class Render {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
attributes: {
|
attributes: {
|
||||||
preload: false,
|
playsinline: 'playsinline',
|
||||||
controls: true
|
controls: 'controls'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue