Merge main (auto-save played videos, lyrics editor audio) into beta
This commit is contained in:
@@ -657,6 +657,7 @@ const DEFAULT_SETTINGS = {
|
||||
quality: 'auto', volume: 1, audioOnly: false, autoPreload: true,
|
||||
p2pShare: true, // P2P (docs/p2p-architecture.md): share my saved videos with other devices — ON by default
|
||||
p2pReceive: true, // fetch from other devices when YouTube and the server can't — ON by default
|
||||
autoSavePlayed: true, // keep every video you play for offline (background save once playback starts)
|
||||
saveBeforePlay: false, // download (server-muxed single file) before playing instead of streaming
|
||||
repeatMode: 'off', // 'off' | 'all' — repeat the playing list when it ends
|
||||
loopOne: false, // repeat the single current video
|
||||
@@ -1999,6 +2000,20 @@ function markCardCacheState(id, state) {
|
||||
});
|
||||
}
|
||||
|
||||
// Auto-save what you play: once a video starts playing, save it in the
|
||||
// background (never delays playback). One attempt per video per page session.
|
||||
const autoSaveTried = new Set();
|
||||
document.addEventListener('play', () => {
|
||||
const m = current && current.meta;
|
||||
if (!m || !m.id || m.custom || current.localUrl) return;
|
||||
if (data.settings.autoSavePlayed === false) return;
|
||||
if (!WEB) return;
|
||||
if (cachedIds.has(m.id) || downloading.has(m.id) || autoSaveTried.has(m.id)) return;
|
||||
autoSaveTried.add(m.id);
|
||||
preload(m, { quiet: true });
|
||||
}, true);
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// Video editor — cut parts out of a video and save a custom offline copy
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user