mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
avoid safari bugs on touchbar macbooks:
* songs would play backwards * playback started immediately on folder change
This commit is contained in:
parent
fa953ced52
commit
f2a7925387
|
@ -1485,8 +1485,8 @@ var mpl = (function () {
|
|||
ebi('np_img').setAttribute('src', cover); // dont give last.fm the pwd
|
||||
|
||||
navigator.mediaSession.metadata = new MediaMetadata(tags);
|
||||
navigator.mediaSession.setActionHandler('play', playpause);
|
||||
navigator.mediaSession.setActionHandler('pause', playpause);
|
||||
navigator.mediaSession.setActionHandler('play', mplay);
|
||||
navigator.mediaSession.setActionHandler('pause', mpause);
|
||||
navigator.mediaSession.setActionHandler('seekbackward', r.os_seek ? function () { seek_au_rel(-10); } : null);
|
||||
navigator.mediaSession.setActionHandler('seekforward', r.os_seek ? function () { seek_au_rel(10); } : null);
|
||||
navigator.mediaSession.setActionHandler('previoustrack', prev_song);
|
||||
|
@ -1501,6 +1501,10 @@ var mpl = (function () {
|
|||
|
||||
navigator.mediaSession.metadata = null;
|
||||
navigator.mediaSession.playbackState = "paused";
|
||||
|
||||
var hs = 'play pause seekbackward seekforward previoustrack nexttrack'.split(/ /g);
|
||||
for (var a = 0; a < hs.length; a++)
|
||||
navigator.mediaSession.setActionHandler(hs[a], null);
|
||||
};
|
||||
|
||||
r.unbuffer = function (url) {
|
||||
|
@ -2193,6 +2197,22 @@ function playpause(e) {
|
|||
};
|
||||
|
||||
|
||||
function mplay(e) {
|
||||
if (mp && mp.au && !mp.au.paused)
|
||||
return;
|
||||
|
||||
playpause(e);
|
||||
}
|
||||
|
||||
|
||||
function mpause(e) {
|
||||
if (mp && mp.au && mp.au.paused)
|
||||
return;
|
||||
|
||||
playpause(e);
|
||||
}
|
||||
|
||||
|
||||
// hook up the widget buttons
|
||||
(function () {
|
||||
ebi('bplay').onclick = playpause;
|
||||
|
|
Loading…
Reference in a new issue