mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
feat(plugin/web): support for nexttrack keypress
This commit is contained in:
parent
fe98841e72
commit
545213421b
2 changed files with 9 additions and 1 deletions
|
|
@ -241,6 +241,11 @@ var AppView = Backbone.View.extend({
|
||||||
'pause': _.bind(this.audioPause, this),
|
'pause': _.bind(this.audioPause, this),
|
||||||
'ended': _.bind(this.audioEnded, this)
|
'ended': _.bind(this.audioEnded, this)
|
||||||
});
|
});
|
||||||
|
if ("mediaSession" in navigator) {
|
||||||
|
navigator.mediaSession.setActionHandler("nexttrack", () => {
|
||||||
|
this.playNext();
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showItems: function(items) {
|
showItems: function(items) {
|
||||||
this.shownItems = items;
|
this.shownItems = items;
|
||||||
|
|
@ -306,7 +311,9 @@ var AppView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
audioEnded: function() {
|
audioEnded: function() {
|
||||||
this.playingItem.entryView.setPlaying(false);
|
this.playingItem.entryView.setPlaying(false);
|
||||||
|
this.playNext();
|
||||||
|
},
|
||||||
|
playNext: function(){
|
||||||
// Try to play the next track.
|
// Try to play the next track.
|
||||||
var idx = this.shownItems.indexOf(this.playingItem);
|
var idx = this.shownItems.indexOf(this.playingItem);
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ New features:
|
||||||
:bug:`3354`
|
:bug:`3354`
|
||||||
- :doc:`plugins/discogs` Support for name variations and config options to
|
- :doc:`plugins/discogs` Support for name variations and config options to
|
||||||
specify where the variations are written. :bug:`3354`
|
specify where the variations are written. :bug:`3354`
|
||||||
|
- :doc:`plugins/web` Support for `nexttrack` keyboard press
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue