From b024c51fb643e58426bdade0e4f4611bbe84ff09 Mon Sep 17 00:00:00 2001 From: Alexandru Branza Date: Mon, 23 Dec 2024 11:41:00 +0200 Subject: [PATCH 1/3] Fix Setting Audio Track At Start --- src/ShellVideo/ShellVideo.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ShellVideo/ShellVideo.js b/src/ShellVideo/ShellVideo.js index 77cd095..6966fe1 100644 --- a/src/ShellVideo/ShellVideo.js +++ b/src/ShellVideo/ShellVideo.js @@ -352,7 +352,12 @@ function ShellVideo(options) { } ipc.send('mpv-set-prop', ['pause', false]); ipc.send('mpv-set-prop', ['speed', props.speed]); - ipc.send('mpv-set-prop', ['aid', props.aid]); + if (props.aid) { + if (typeof props.aid === 'string' && props.aid.startsWith('EMBEDDED_')) + ipc.send('mpv-set-prop', ['aid', props.aid.slice('EMBEDDED_'.length)]); + else + ipc.send('mpv-set-prop', ['aid', props.aid]); + } ipc.send('mpv-set-prop', ['mute', 'no']); onPropChanged('paused'); From 06c7ff802c301257e47e2ee43e6adccf088e7af9 Mon Sep 17 00:00:00 2001 From: Alexandru Branza Date: Mon, 23 Dec 2024 11:43:28 +0200 Subject: [PATCH 2/3] Possible Fix for Background Issue --- src/ShellVideo/ShellVideo.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ShellVideo/ShellVideo.js b/src/ShellVideo/ShellVideo.js index 6966fe1..356ad0c 100644 --- a/src/ShellVideo/ShellVideo.js +++ b/src/ShellVideo/ShellVideo.js @@ -116,6 +116,7 @@ function ShellVideo(options) { break; } case 'duration': { + setBackground(false); var intDuration = args.data | 0; // Accumulate average duration over time. if it is greater than minClipDuration // and equal to the currently reported duration, it is returned as video length. @@ -325,8 +326,6 @@ function ShellVideo(options) { stream = commandArgs.stream; onPropChanged('stream'); - setBackground(false); - ipc.send('mpv-set-prop', ['no-sub-ass']); // opengl-cb is an alias for the new name "libmpv", as shown in mpv's video/out/vo.c aliases From d46370e42f69864660e4f4f3cf05d3cf510c9346 Mon Sep 17 00:00:00 2001 From: Alexandru Branza Date: Mon, 23 Dec 2024 11:49:13 +0200 Subject: [PATCH 3/3] Lint --- src/ShellVideo/ShellVideo.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ShellVideo/ShellVideo.js b/src/ShellVideo/ShellVideo.js index 356ad0c..a206990 100644 --- a/src/ShellVideo/ShellVideo.js +++ b/src/ShellVideo/ShellVideo.js @@ -352,10 +352,11 @@ function ShellVideo(options) { ipc.send('mpv-set-prop', ['pause', false]); ipc.send('mpv-set-prop', ['speed', props.speed]); if (props.aid) { - if (typeof props.aid === 'string' && props.aid.startsWith('EMBEDDED_')) + if (typeof props.aid === 'string' && props.aid.startsWith('EMBEDDED_')) { ipc.send('mpv-set-prop', ['aid', props.aid.slice('EMBEDDED_'.length)]); - else + } else { ipc.send('mpv-set-prop', ['aid', props.aid]); + } } ipc.send('mpv-set-prop', ['mute', 'no']);