diff options
author | Humberto Alfonso Díaz <humberto.alfonso@asvito.es> | 2019-12-10 09:08:43 +0100 |
---|---|---|
committer | Lorenzo Tilve <ltilve@igalia.com> | 2020-02-04 19:16:01 +0100 |
commit | 75596a5c7d09cfeaf08d7a20950362a7eb158af5 (patch) | |
tree | f0c728fd511c17e87309d3b6721f7585b20ad81e /src/js | |
parent | 997339efe2a907f10ed665eadf400a49794c6872 (diff) |
FUNCT Add loop support to player
Diffstat (limited to 'src/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); |