diff options
Diffstat (limited to 'libs/music/player.d/main_static.js')
-rw-r--r-- | libs/music/player.d/main_static.js | 23 |
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={ |