mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
event hints for ogvjs playback
This commit is contained in:
parent
9366512f2f
commit
e0a14ec881
|
@ -814,6 +814,7 @@ function prev_song(e) {
|
||||||
|
|
||||||
|
|
||||||
function playpause(e) {
|
function playpause(e) {
|
||||||
|
// must be event-chain
|
||||||
ev(e);
|
ev(e);
|
||||||
if (mp.au) {
|
if (mp.au) {
|
||||||
if (mp.au.paused)
|
if (mp.au.paused)
|
||||||
|
@ -824,7 +825,7 @@ function playpause(e) {
|
||||||
mpui.progress_updater();
|
mpui.progress_updater();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
play(0);
|
play(0, true);
|
||||||
|
|
||||||
if (navigator.mediaSession)
|
if (navigator.mediaSession)
|
||||||
navigator.mediaSession.playbackState = mp.au.paused ? "paused" : "playing";
|
navigator.mediaSession.playbackState = mp.au.paused ? "paused" : "playing";
|
||||||
|
@ -838,7 +839,7 @@ function playpause(e) {
|
||||||
ebi('bnext').onclick = next_song;
|
ebi('bnext').onclick = next_song;
|
||||||
ebi('barpos').onclick = function (e) {
|
ebi('barpos').onclick = function (e) {
|
||||||
if (!mp.au) {
|
if (!mp.au) {
|
||||||
play(0);
|
play(0, true);
|
||||||
return mp.fade_in();
|
return mp.fade_in();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,7 +917,7 @@ function ev_play(e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
|
|
||||||
var fade = !mp.au || mp.au.paused;
|
var fade = !mp.au || mp.au.paused;
|
||||||
play(this.getAttribute('id').slice(1));
|
play(this.getAttribute('id').slice(1), true);
|
||||||
if (fade)
|
if (fade)
|
||||||
mp.fade_in();
|
mp.fade_in();
|
||||||
|
|
||||||
|
@ -1158,7 +1159,7 @@ var audio_eq = (function () {
|
||||||
|
|
||||||
|
|
||||||
// plays the tid'th audio file on the page
|
// plays the tid'th audio file on the page
|
||||||
function play(tid, seek, call_depth) {
|
function play(tid, is_ev, seek, call_depth) {
|
||||||
if (mp.order.length == 0)
|
if (mp.order.length == 0)
|
||||||
return console.log('no audio found wait what');
|
return console.log('no audio found wait what');
|
||||||
|
|
||||||
|
@ -1205,7 +1206,7 @@ function play(tid, seek, call_depth) {
|
||||||
}
|
}
|
||||||
else if (window['OGVPlayer']) {
|
else if (window['OGVPlayer']) {
|
||||||
mp.au = mp.au_ogvjs = new OGVPlayer();
|
mp.au = mp.au_ogvjs = new OGVPlayer();
|
||||||
attempt_play = false;
|
attempt_play = is_ev;
|
||||||
mp.au.addEventListener('error', evau_error, true);
|
mp.au.addEventListener('error', evau_error, true);
|
||||||
mp.au.addEventListener('progress', pbar.drawpos);
|
mp.au.addEventListener('progress', pbar.drawpos);
|
||||||
mp.au.addEventListener('ended', next_song);
|
mp.au.addEventListener('ended', next_song);
|
||||||
|
@ -1218,7 +1219,7 @@ function play(tid, seek, call_depth) {
|
||||||
show_modal('<h1>loading ogv.js</h1><h2>thanks apple</h2>');
|
show_modal('<h1>loading ogv.js</h1><h2>thanks apple</h2>');
|
||||||
|
|
||||||
import_js('/.cpr/deps/ogv.js', function () {
|
import_js('/.cpr/deps/ogv.js', function () {
|
||||||
play(tid, seek, 1);
|
play(tid, false, seek, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1357,7 +1358,7 @@ function autoplay_blocked(seek) {
|
||||||
// chrome 91 may permanently taint on a failed play()
|
// chrome 91 may permanently taint on a failed play()
|
||||||
// depending on win10 settings or something? idk
|
// depending on win10 settings or something? idk
|
||||||
mp.au_native = mp.au_ogvjs = null;
|
mp.au_native = mp.au_ogvjs = null;
|
||||||
play(tid, seek);
|
play(tid, true, seek);
|
||||||
mp.fade_in();
|
mp.fade_in();
|
||||||
};
|
};
|
||||||
na.onclick = unblocked;
|
na.onclick = unblocked;
|
||||||
|
@ -1379,7 +1380,7 @@ function autoplay_blocked(seek) {
|
||||||
if (!m)
|
if (!m)
|
||||||
return play(id[0]);
|
return play(id[0]);
|
||||||
|
|
||||||
return play(id[0], parseInt(m[1] || 0) * 60 + parseInt(m[2] || 0));
|
return play(id[0], false, parseInt(m[1] || 0) * 60 + parseInt(m[2] || 0));
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue