From 78e93f79eeeadb87663c4c80236a4293661004f1 Mon Sep 17 00:00:00 2001 From: Humberto Alfonso Díaz Date: Tue, 10 Dec 2019 09:45:35 +0100 Subject: FUNCT Add support to seek --- src/js/player.js | 10 ++++++++++ src/styles/main.scss | 2 +- src/templates/player.template.html | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/js/player.js b/src/js/player.js index 5efdc2c..3fc34c7 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -97,4 +97,14 @@ export function previous() { export function next() { mediaplayer.next(); +} + +export function seek(node, event) { + /* + * The -15 is to adjust the default margin. + */ + var position = Math.round(page.metadata.track.duration * ((event.pageX-15)/node.clientWidth)); + mediaplayer.play().then(function() { + mediaplayer.seek(position); + }); } \ No newline at end of file diff --git a/src/styles/main.scss b/src/styles/main.scss index ab40398..7490907 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -16,7 +16,7 @@ body { .playlistContainer { margin: 15px 0; overflow: scroll; - bottom: 200px; + bottom: 222px; } .log { diff --git a/src/templates/player.template.html b/src/templates/player.template.html index ebf98cc..4c7662d 100644 --- a/src/templates/player.template.html +++ b/src/templates/player.template.html @@ -25,9 +25,9 @@ {{ getDuration }} -
+
-
+
-- cgit 1.2.3-korg