summaryrefslogtreecommitdiffstats
path: root/src/js/player.js
diff options
context:
space:
mode:
authorHumberto Alfonso Díaz <humberto.alfonso@asvito.es>2019-12-10 09:45:35 +0100
committerLorenzo Tilve <ltilve@igalia.com>2020-02-04 19:16:01 +0100
commit78e93f79eeeadb87663c4c80236a4293661004f1 (patch)
tree79816906e62f459c20343c4156ed927fb6380865 /src/js/player.js
parent75596a5c7d09cfeaf08d7a20950362a7eb158af5 (diff)
FUNCT Add support to seek
Diffstat (limited to 'src/js/player.js')
-rw-r--r--src/js/player.js10
1 files changed, 10 insertions, 0 deletions
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