fix: sync queue insert/append to native Android player
Both 'Als Nächstes einfügen' and 'Am Ende der Queue' updated S.queue in JS but never called NSBridge, so the native ExoPlayer ignored the change and kept playing the original next item. - Export nativeInsertAt(song, position) from player.js - Call it in showCtxMenu with the exact splice index for insert-next and -1 (append) for add-to-end Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
e893b7cc12
commit
68bec67880
2 files changed
+13
-3
No files matched your search
@@ -3,7 +3,7 @@ import { esc, formatDur, toast } from './utils.js';
|
||||
import { api, coverUrl, ndAuth } from './api.js';
|
||||
import { THEMES, applyTheme, getCurrentThemeId } from './themes.js';
|
||||
// Circular imports — safe (only used inside function bodies)
|
||||
import { playQueue, dlSongLocal, toggleStar, togglePlay, renderQueue, syncNpStar, updateStarBtn, npToggleStar, playCurrent, _syncNpDirect, setPlayIcon } from './player.js';
|
||||
import { playQueue, dlSongLocal, toggleStar, togglePlay, renderQueue, syncNpStar, updateStarBtn, npToggleStar, playCurrent, _syncNpDirect, setPlayIcon, nativeInsertAt } from './player.js';
|
||||
import { navigate, loadPlaylists } from './views.js';
|
||||
|
||||
// ─── SIDEBAR ───
|
||||
@@ -115,11 +115,15 @@ export function showCtxMenu(e, song, list, idx) {
|
||||
const items = [
|
||||
{ icon: '▶', label: 'Abspielen', fn: () => playQueue(list, idx) },
|
||||
{ icon: '+', label: 'Als Nächstes einfügen', fn: () => {
|
||||
S.queue.splice(S.qIdx+1, 0, {...song});
|
||||
const insertIdx = S.qIdx + 1;
|
||||
S.queue.splice(insertIdx, 0, {...song});
|
||||
nativeInsertAt(song, insertIdx);
|
||||
renderQueue(); toast('In Warteschlange eingefügt');
|
||||
}},
|
||||
{ icon: '⬇', label: 'Am Ende der Queue', fn: () => {
|
||||
S.queue.push({...song}); renderQueue(); toast('Zur Queue hinzugefügt');
|
||||
S.queue.push({...song});
|
||||
nativeInsertAt(song, -1);
|
||||
renderQueue(); toast('Zur Queue hinzugefügt');
|
||||
}},
|
||||
{ sep: true },
|
||||
{ icon: '🎶', label: 'Zu Playlist hinzufügen →', submenu: true, fn: () => openPlModal([song]) },
|
||||
|
||||
Reference in new issue
Block a user