From 7d0311fd649e758a087f207de7f66717a15c28d1 Mon Sep 17 00:00:00 2001 From: Ivan Vermeyen Date: Fri, 12 Feb 2016 17:11:07 +0100 Subject: [PATCH 1/4] Allow player control colors to be overridden #158 --- src/sass/plyr.scss | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sass/plyr.scss b/src/sass/plyr.scss index dd118602..2f0193a8 100644 --- a/src/sass/plyr.scss +++ b/src/sass/plyr.scss @@ -27,21 +27,19 @@ $plyr-font-size-captions-large: ($plyr-font-size-base * 2) !default; $plyr-control-spacing: 10px !default; $plyr-controls-bg: #fff !default; $plyr-control-bg-hover: $plyr-blue !default; -$plyr-control-color: null !default; -$plyr-control-color-hover: null !default; // Contrast @if lightness($plyr-controls-bg) >= 65% { - $plyr-control-color: $plyr-gray-light; + $plyr-control-color: $plyr-gray-light !default; } @else { - $plyr-control-color: $plyr-gray-lighter; + $plyr-control-color: $plyr-gray-lighter !default; } @if lightness($plyr-control-bg-hover) >= 65% { - $plyr-control-color-hover: $plyr-gray; + $plyr-control-color-hover: $plyr-gray !default; } @else { - $plyr-control-color-hover: #fff; + $plyr-control-color-hover: #fff !default; } // Tooltips From 96df8fbc859ec04626bc403548e33ba0dde91dc4 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Sun, 14 Feb 2016 14:04:30 +1100 Subject: [PATCH 2/4] Update readme.md --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 0c7e4c66..982c6df4 100644 --- a/readme.md +++ b/readme.md @@ -831,6 +831,7 @@ Plyr is developed by [@sam_potts](https://twitter.com/sam_potts) / [sampotts.me] ## Used by - [Selz.com](https://selz.com) +- [koel](https://github.com/phanan/koel) - A personal music streaming server that works Let me know on [Twitter](https://twitter.com/sam_potts) I can add you to the above list. It'd be awesome to see how you're using Plyr :-) From 67f19166ac92d5adc03c9421300149260a6424ac Mon Sep 17 00:00:00 2001 From: Guru Prasad Srinivasa Date: Tue, 16 Feb 2016 19:52:08 -0500 Subject: [PATCH 3/4] Some WebVTT fixes to allow manual captions WebVTT allows additional parameters along with the line that contains the start and end times. These were not being filtered out while attempting to manually display captions. --- src/js/plyr.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index fce746db..2f50bb69 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -820,15 +820,21 @@ } // Utilities for caption time codes - function _timecodeMin(tc) { + function _timecodeCommon(tc, pos) { var tcpair = []; tcpair = tc.split(' --> '); - return _subTcSecs(tcpair[0]); + for(var i = 0; i < tcpair.length; i++) { + // WebVTT allows for extra meta data after the timestamp line + // So get rid of this if it exists + tcpair[i] = tcpair[i].replace(/(\d+:\d+:\d+\.\d+).*/, "$1"); + } + return _subTcSecs(tcpair[pos]); + } + function _timecodeMin(tc) { + return _timecodeCommon(tc, 0); } function _timecodeMax(tc) { - var tcpair = []; - tcpair = tc.split(' --> '); - return _subTcSecs(tcpair[1]); + return _timecodeCommon(tc, 1); } function _subTcSecs(tc) { if (tc === null || tc === undefined) { From 402c45ee2bf1d528ea1c3ea333dfa7fcb7dd79af Mon Sep 17 00:00:00 2001 From: Guru Prasad Srinivasa Date: Tue, 16 Feb 2016 19:53:07 -0500 Subject: [PATCH 4/4] Updated manual caption split pattern Previously, Plyr was using a fixed pattern of '\n\n' to split contents into captions. This does not always work as some VTT files contain '\r\n'. This commit checks for both. --- src/js/plyr.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index 2f50bb69..b2b9c964 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1523,12 +1523,18 @@ record, req = xhr.responseText; - records = req.split('\n\n'); - + var pattern = '\n'; + records = req.split(pattern + pattern); + if(records.length === 1) { + // The '\n' pattern didn't work + // Try '\r\n' + pattern = '\r\n'; + records = req.split(pattern + pattern); + } for (var r = 0; r < records.length; r++) { record = records[r]; plyr.captions[r] = []; - plyr.captions[r] = record.split('\n'); + plyr.captions[r] = record.split(pattern); } // Remove first element ('VTT')