diff options
Diffstat (limited to 'src/js/player.js')
-rw-r--r-- | src/js/player.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/js/player.js b/src/js/player.js index b31c2c6..5efdc2c 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -7,6 +7,7 @@ var template; var root; var page = { metadata: {}, + isLooping: false, getPosition: function() { if ( this.metadata && this.metadata.position ) { return formatTime(this.metadata.position); @@ -64,6 +65,20 @@ export function init(node) { }); } +export function loop() { + if( !page.isLooping ) { + mediaplayer.loop('track').then(function() { + page.isLooping = true; + show(); + }); + } else { + mediaplayer.loop('playlist').then(function() { + page.isLooping = false; + show(); + }); + } +} + export function play(trackIndex) { if( trackIndex ) { mediaplayer.pickTrack(trackIndex); |