Can skip to a random track on double click
This commit is contained in:
parent
677f93723b
commit
19fa419d89
7 changed files with 83 additions and 0 deletions
|
|
@ -24,6 +24,7 @@
|
|||
<button
|
||||
class="btn btn-sm btn-primary"
|
||||
on:click={() => source.nexttrack()}
|
||||
on:dblclick={() => source.nextrandomtrack()}
|
||||
>
|
||||
<i class="bi bi-skip-forward-fill"></i>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,13 @@ export class Input {
|
|||
}
|
||||
}
|
||||
|
||||
async nextrandomtrack(idstream) {
|
||||
const data = await fetch(`api/inputs/${this.id}/streams/${idstream}/next_random_track`, {headers: {'Accept': 'application/json'}, method: 'POST'});
|
||||
if (data.status != 200) {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
async prevtrack(idstream) {
|
||||
const data = await fetch(`api/inputs/${this.id}/streams/${idstream}/prev_track`, {headers: {'Accept': 'application/json'}, method: 'POST'});
|
||||
if (data.status != 200) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,13 @@ export class Source {
|
|||
}
|
||||
}
|
||||
|
||||
async nextrandomtrack() {
|
||||
const data = await fetch(`api/sources/${this.id}/next_random_track`, {headers: {'Accept': 'application/json'}, method: 'POST'});
|
||||
if (data.status != 200) {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
async prevtrack() {
|
||||
const data = await fetch(`api/sources/${this.id}/prev_track`, {headers: {'Accept': 'application/json'}, method: 'POST'});
|
||||
if (data.status != 200) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue