Fix webvtt formatting
This commit is contained in:
@@ -47,8 +47,6 @@
|
||||
- YT path redirects (So your redirect plugins should still work!)
|
||||
|
||||
# Support table
|
||||
Here’s the updated table with the "ffmpeg download merging" column completely removed:
|
||||
|
||||
| | Dash | HLS | Local video fallback | API-Extended | Dearrow | RYD |
|
||||
|---------|------|-----|----------------------|--------------|---------|-----|
|
||||
| Web | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
import type { VideoPlay } from './api/model';
|
||||
import {
|
||||
getBestThumbnail,
|
||||
padTime,
|
||||
proxyVideoUrl,
|
||||
pullBitratePreference,
|
||||
videoLength,
|
||||
@@ -223,7 +224,7 @@
|
||||
endTime = data.content.timestamps[timestampIndex + 1].timePretty;
|
||||
}
|
||||
|
||||
chapterWebVTT += `${timestamp.timePretty} --> ${endTime}\n${timestamp.title.replaceAll('-', '').trim()}\n\n`;
|
||||
chapterWebVTT += `${padTime(timestamp.timePretty)} --> ${padTime(endTime)}\n${timestamp.title.replaceAll('-', '').trim()}\n\n`;
|
||||
|
||||
timestampIndex += 1;
|
||||
});
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
let hiddenVideos: string[] = [];
|
||||
let auth = get(authStore);
|
||||
let largeCol = '2';
|
||||
|
||||
async function removePlaylistItem(indexId: string, videoId: string) {
|
||||
if (!playlistId) return;
|
||||
|
||||
@@ -107,6 +107,30 @@ export interface PhasedDescription {
|
||||
timestamps: { title: string; time: number; timePretty: string; }[];
|
||||
}
|
||||
|
||||
export function padTime(time: string): string {
|
||||
let timeParts = time.split(':');
|
||||
|
||||
if (timeParts.length < 3) {
|
||||
timeParts = ('00:' + time).split(':');
|
||||
}
|
||||
|
||||
const hours = (timeParts[0] || '0').padStart(2, '0');
|
||||
const minutes = (timeParts[1] || '0').padStart(2, '0');
|
||||
|
||||
let seconds = timeParts[2] || '0';
|
||||
let milliseconds = '';
|
||||
|
||||
if (seconds.includes('.')) {
|
||||
const [sec, ms] = seconds.split('.');
|
||||
seconds = sec.padStart(2, '0');
|
||||
milliseconds = `.${ms.padStart(3, '0')}`;
|
||||
} else {
|
||||
seconds = seconds.padStart(2, '0');
|
||||
}
|
||||
|
||||
return `${hours}:${minutes}:${seconds}${milliseconds}`;
|
||||
}
|
||||
|
||||
export function decodeHtmlCharCodes(str: string): string {
|
||||
const { decode } = he;
|
||||
return decode(str);
|
||||
|
||||
@@ -37,9 +37,6 @@ export default defineConfig({
|
||||
vidstack(),
|
||||
sveltekit()
|
||||
],
|
||||
optimizeDeps: {
|
||||
exclude: ['@ffmpeg/ffmpeg', '@ffmpeg/util'],
|
||||
},
|
||||
ssr: {
|
||||
noExternal: ['beercss']
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user