summaryrefslogtreecommitdiff
path: root/libs/music/player.d/main_static.js
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2024-12-21 21:34:45 -0500
committerGravatar Chris Xiong <chirs241097@gmail.com> 2024-12-21 21:34:45 -0500
commit7fb9b6d30ca00876cd7dd3af7741e40d7a1b640a (patch)
treebe1e337cb01c015fd5aed36701c1730d24577e87 /libs/music/player.d/main_static.js
parent99fd782975857fd69e64447066d84904aa4a7cf6 (diff)
downloadweb-7fb9b6d30ca00876cd7dd3af7741e40d7a1b640a.tar.xz
Fix multitrack playback for ... god knows what browser.
Diffstat (limited to 'libs/music/player.d/main_static.js')
-rw-r--r--libs/music/player.d/main_static.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/libs/music/player.d/main_static.js b/libs/music/player.d/main_static.js
index cf2e610..94658fc 100644
--- a/libs/music/player.d/main_static.js
+++ b/libs/music/player.d/main_static.js
@@ -216,7 +216,6 @@ NSUI={
if(NSUI.selectedplist)
NSUI.switch_playlist(NSUI.selectedplist);
};
- sh.elem('plistsw').onclick=NSUI.togglePlist;
sh.elem('tsliderbase').onclick=
sh.elem('tsliderbase').onmousemove=function(e)
{
@@ -269,13 +268,7 @@ NSUI={
return false;
}
if(e.key=='c')
- if(NSUI.audio.audioTracks.length==2)
- {
- const t=NSUI.audio.currentTime;
- NSUI.audio.audioTracks[0].enabled^=1;
- NSUI.audio.audioTracks[1].enabled^=1;
- NSUI.audio.currentTime=t;
- }
+ return NSAudio.switchAudioTrack();
return true;
};
},
@@ -481,12 +474,22 @@ NSAudio={
},
connect:function()
{
- if(this.srcnode===null)
+ if(this.srcnode===null)
this.srcnode=this.audioctx.createMediaElementSource(NSUI.audio);
this.srcnode.connect(this.anlznode);
this.anlznode.connect(this.audioctx.destination);
- if(this.audioctx.state!="running")throw "resume required";
+ if(this.audioctx.state!="running")throw "resume required";
},
+ switchAudioTrack:function()
+ {
+ const a = NSUI.audio;
+ if (a.audioTracks.length != 2) return false;
+ const t = a.currentTime;
+ const e = a.audioTracks[0].enabled;
+ [a.audioTracks[0].enabled, a.audioTracks[1].enabled] = [!e, e];
+ a.currentTime = t;
+ return true;
+ }
};
NSVisualization={