summaryrefslogtreecommitdiff
path: root/libs/music
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-12-20 00:37:10 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-12-20 00:37:10 +0800
commit4a6bd11b5ccad0f7610af4f785aeaf5c9658314e (patch)
tree5057622dee85d044eb3b513e9e1e99e21fc61273 /libs/music
parenta732e377785d62d2bb02d4a80021038e0f573412 (diff)
downloadweb-4a6bd11b5ccad0f7610af4f785aeaf5c9658314e.tar.xz
Added multitrack audio support.
Diffstat (limited to 'libs/music')
-rw-r--r--libs/music/player5
-rw-r--r--libs/music/player.d/main_static.js26
2 files changed, 29 insertions, 2 deletions
diff --git a/libs/music/player b/libs/music/player
index 8ce5871..8b9e78d 100644
--- a/libs/music/player
+++ b/libs/music/player
@@ -62,6 +62,8 @@
The Stupid Online Player
License: Expat (MIT)
Changelog:
+2019.12.20 2.6.0
+Added multitrack audio support.
2018.11.29 2.5.4
Tidied the code up a bit.
2018.11.29 2.5.3+b2
@@ -127,7 +129,7 @@ The online player was added.
<li><a href="/libs/music/player"><h2>Music Library</h2></a></li>
<li><ul id="plists"></ul></li>
<li><a href="//filestorage.chrisoft.org/music/" target="_blank">Downloads</a></li>
- <li><a>TSOP 2.5.3</a></li>
+ <li><a>TSOP 2.6.0</a></li>
</ul>
</div>
<div id="content">
@@ -139,6 +141,7 @@ The online player was added.
<div id="ctrlcontainer" class="footer TText widgetbg">
<div class="switches" style="text-align:right;padding-top:0.25em 0 0.25em 0;">
<div style="text-align:center;width:100%;" id="nowplaying"></div>
+ <span id="mt" style="display:none;">Press C to switch tracks</span>
<a id="am3u8" href="#">[m3u8 Playlist]</a>
<a id="plistsw" href="javascript:void(0);">[Hide Playlist]</a>
</div>
diff --git a/libs/music/player.d/main_static.js b/libs/music/player.d/main_static.js
index 311aa99..213dcc9 100644
--- a/libs/music/player.d/main_static.js
+++ b/libs/music/player.d/main_static.js
@@ -197,7 +197,7 @@ NSUI={
NSUI.audio.currentTime=NSUI.audio.duration*p;
}
};
- NSUI.iplaypause.onclick=function()
+ const playpausef=function()
{
if(NSUI.audio.src=='')
{
@@ -219,6 +219,7 @@ NSUI={
NSUI.iplaypause.style.backgroundPosition=`${NSUI.bplayrect}`;
}
};
+ NSUI.iplaypause.onclick=playpausef;
NSUI.pbprev.onclick=function()
{
if(NSUI.audio.currentTime>10)NSUI.audio.currentTime=0;
@@ -230,6 +231,23 @@ NSUI={
navigator.mediaSession.setActionHandler('previoustrack',NSUI.pbprev.onclick);
navigator.mediaSession.setActionHandler('nexttrack',NSUI.pbnext.onclick);
}
+ window.onkeydown=function(e)
+ {
+ if(e.key==' ')
+ {
+ playpausef();
+ 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 true;
+ };
},
load_playlists:async function()
{
@@ -614,6 +632,12 @@ function init()
NSVisualization.init();NSInk.inkPrepare();
NSUI.audio.ontimeupdate=NSUI.timeUpdate;
NSUI.audio.onended=NSPlayer.next.bind(NSPlayer);
+ NSUI.audio.onplay=NSUI.audio.ondurationchange=function(){
+ if(NSUI.audio.audioTracks.length==2)
+ sh.elem('mt').style.display='inline';
+ else
+ sh.elem('mt').style.display='none';
+ };
switch(sh.getcookie('playershuffle'))
{
case '1':NSPlayer.shuffle=1;break;