aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2015-02-28 12:07:21 +1100
committerSam Potts <me@sampotts.me>2015-02-28 12:07:21 +1100
commit35ac236a0067c4688c60e5a40c1f7188d3c0db15 (patch)
tree8871fabc2c3503bb34fa468faf7ce9fc4d177008 /src
parentdd17100a5330a495837d645546d8b733a621b058 (diff)
downloadplyr-35ac236a0067c4688c60e5a40c1f7188d3c0db15.tar.lz
plyr-35ac236a0067c4688c60e5a40c1f7188d3c0db15.tar.xz
plyr-35ac236a0067c4688c60e5a40c1f7188d3c0db15.zip
Updates to docs, fix for seek time in controls
Diffstat (limited to 'src')
-rw-r--r--src/js/plyr.js25
-rw-r--r--src/templates/controls.html4
2 files changed, 16 insertions, 13 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 969799ae..97cb273f 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -16,7 +16,7 @@
var defaults = {
enabled: true,
debug: false,
- seekInterval: 10,
+ seekTime: 10,
volume: 5,
click: true,
selectors: {
@@ -435,6 +435,9 @@
// Replace aria label instances
html = _replaceAll(html, "{aria-label}", config.playAriaLabel);
+ // Replace seek time instances
+ html = _replaceAll(html, "{seek-time}", config.seekTime);
+
// Replace all id references
html = _replaceAll(html, "{id}", player.random);
@@ -688,8 +691,8 @@
// Setup seeking
function _setupSeeking() {
// Update number of seconds in rewind and fast forward buttons
- player.seekTime[0].innerHTML = config.seekInterval;
- player.seekTime[1].innerHTML = config.seekInterval;
+ player.seekTime[0].innerHTML = config.seekTime;
+ player.seekTime[1].innerHTML = config.seekTime;
}
// Setup fullscreen
@@ -735,13 +738,13 @@
}
// Rewind
- function _rewind(seekInterval) {
+ function _rewind(seekTime) {
// Use default if needed
- if(typeof seekInterval !== "number") {
- seekInterval = config.seekInterval;
+ if(typeof seekTime !== "number") {
+ seekTime = config.seekTime;
}
- var targetTime = player.media.currentTime - seekInterval;
+ var targetTime = player.media.currentTime - seekTime;
if (targetTime < 0) {
player.media.currentTime = 0;
@@ -756,13 +759,13 @@
}
// Fast forward
- function _forward(seekInterval) {
+ function _forward(seekTime) {
// Use default if needed
- if(typeof seekInterval !== "number") {
- seekInterval = config.seekInterval;
+ if(typeof seekTime !== "number") {
+ seekTime = config.seekTime;
}
- var targetTime = player.media.currentTime + seekInterval;
+ var targetTime = player.media.currentTime + seekTime;
if (targetTime > player.media.duration) {
player.media.currentTime = player.media.duration;
diff --git a/src/templates/controls.html b/src/templates/controls.html
index 3ae8d8c4..d25c52ee 100644
--- a/src/templates/controls.html
+++ b/src/templates/controls.html
@@ -14,7 +14,7 @@
</button>
<button type="button" data-player="rewind">
<svg><use xlink:href="#icon-rewind"></use></svg>
- <span class="sr-only">Rewind <span class="player-seek-time">10</span> seconds</span>
+ <span class="sr-only">Rewind <span class="player-seek-time">{seek-time}</span> seconds</span>
</button>
<button type="button" aria-label="{aria-label}" data-player="play">
<svg><use xlink:href="#icon-play"></use></svg>
@@ -26,7 +26,7 @@
</button>
<button type="button" data-player="fast-forward">
<svg><use xlink:href="#icon-fast-forward"></use></svg>
- <span class="sr-only">Fast forward <span class="player-seek-time">10</span> seconds</span>
+ <span class="sr-only">Fast forward <span class="player-seek-time">{seek-time}</span> seconds</span>
</button>
<span class="player-time">
<span class="sr-only">Time</span>