Spaces:
Running
Running
JOHN SILLVESTOR commited on
Allow MP4 metadata tail for preview playback
Browse files
server.js
CHANGED
|
@@ -1225,7 +1225,7 @@ async function fillDuration(bot, rec, msgId) {
|
|
| 1225 |
return d;
|
| 1226 |
}
|
| 1227 |
|
| 1228 |
-
const TAIL_MAX =
|
| 1229 |
const TAIL_MIN_SIZE = 48 * MB;
|
| 1230 |
|
| 1231 |
function lvlPct(l) {
|
|
@@ -1324,7 +1324,7 @@ function applyPreview(rng, size, l, msgId, ticket) {
|
|
| 1324 |
const dur = td > 1 ? td : (durCache.get(String(msgId || "")) || 0);
|
| 1325 |
const maxEnd = previewMaxEnd(size, l, msgId, dur);
|
| 1326 |
const tailAllowed = size >= TAIL_MIN_SIZE;
|
| 1327 |
-
const tailWin = tailAllowed ? Math.max(0, size - Math.min(TAIL_MAX, Math.floor(size * 0.
|
| 1328 |
if (tailAllowed && rng.start >= tailWin) {
|
| 1329 |
return { start: rng.start, end: endCap, partial: true };
|
| 1330 |
}
|
|
|
|
| 1225 |
return d;
|
| 1226 |
}
|
| 1227 |
|
| 1228 |
+
const TAIL_MAX = 256 * MB;
|
| 1229 |
const TAIL_MIN_SIZE = 48 * MB;
|
| 1230 |
|
| 1231 |
function lvlPct(l) {
|
|
|
|
| 1324 |
const dur = td > 1 ? td : (durCache.get(String(msgId || "")) || 0);
|
| 1325 |
const maxEnd = previewMaxEnd(size, l, msgId, dur);
|
| 1326 |
const tailAllowed = size >= TAIL_MIN_SIZE;
|
| 1327 |
+
const tailWin = tailAllowed ? Math.max(0, size - Math.min(TAIL_MAX, Math.max(16 * MB, Math.floor(size * 0.15)))) : Infinity;
|
| 1328 |
if (tailAllowed && rng.start >= tailWin) {
|
| 1329 |
return { start: rng.start, end: endCap, partial: true };
|
| 1330 |
}
|