From 7ec3cf2de352bd053a3fa4da96eadfde7db2ae84 Mon Sep 17 00:00:00 2001 From: Johannes Burk Date: Fri, 8 May 2015 10:32:11 +0200 Subject: [PATCH 1/3] filter_jwplayer: Add support for 'chapters' and 'thumbnails' tracks --- lib.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib.php b/lib.php index 1baec4b..c23a494 100644 --- a/lib.php +++ b/lib.php @@ -161,9 +161,15 @@ public function embed($urls, $name, $width, $height, $options) { if (isset($options['subtitles'])) { $tracks = array(); foreach ($options['subtitles'] as $label => $subtitlefileurl) { - $tracks[] = array( - 'file' => $subtitlefileurl->out(), - 'label' => $label); + if ($label == 'chapters' || $label == 'thumbnails') { + $tracks[] = array( + 'file' => $subtitlefileurl->out(), + 'kind' => $label); + } else { + $tracks[] = array( + 'file' => $subtitlefileurl->out(), + 'label' => $label); + } } $playlistitem['tracks'] = $tracks; } From fd35040ef36b087271b1e4183eead39afca1aa85 Mon Sep 17 00:00:00 2001 From: Johannes Burk Date: Fri, 8 May 2015 11:58:10 +0200 Subject: [PATCH 2/3] php doc adjusted --- lib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib.php b/lib.php index c23a494..cc09b38 100644 --- a/lib.php +++ b/lib.php @@ -119,7 +119,14 @@ class filter_jwplayer_media extends core_media_player { * subtitles * use 'subtitles' key with an array of subtitle track files * in vtt or srt format indexed by label name. - * Example: $options['subtitles']['English'] = http://example.com/english.vtt + * use 'chapters' or 'thumbnail' index for adding chapters/thumbnails + * to the video. see: + * * http://support.jwplayer.com/customer/portal/articles/1407438-adding-closed-captions + * * http://support.jwplayer.com/customer/portal/articles/1407454-adding-chapter-markers + * * http://support.jwplayer.com/customer/portal/articles/1407439-adding-preview-thumbnails + * Examples: + * $options['subtitles']['English'] = http://example.com/english.vtt + * $options['subtitles']['chapters'] = http://example.com/chapters.vtt * @return string HTML code for embed */ public function embed($urls, $name, $width, $height, $options) { From a0d8aff5472b98382dea18e3bfd35d5be1a396cc Mon Sep 17 00:00:00 2001 From: Johannes Burk Date: Mon, 11 May 2015 08:04:00 +0200 Subject: [PATCH 3/3] phpdoc fixed: url to track files must be moodle_url object --- lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib.php b/lib.php index cc09b38..9076862 100644 --- a/lib.php +++ b/lib.php @@ -117,7 +117,7 @@ class filter_jwplayer_media extends core_media_player { * @param int $height Optional height; 0 to use default * @param array $options Options array * subtitles - * use 'subtitles' key with an array of subtitle track files + * use 'subtitles' key with an array of moodle_url to subtitle track files * in vtt or srt format indexed by label name. * use 'chapters' or 'thumbnail' index for adding chapters/thumbnails * to the video. see: @@ -125,8 +125,8 @@ class filter_jwplayer_media extends core_media_player { * * http://support.jwplayer.com/customer/portal/articles/1407454-adding-chapter-markers * * http://support.jwplayer.com/customer/portal/articles/1407439-adding-preview-thumbnails * Examples: - * $options['subtitles']['English'] = http://example.com/english.vtt - * $options['subtitles']['chapters'] = http://example.com/chapters.vtt + * $options['subtitles']['English'] = new moodle_url('english.vtt') + * $options['subtitles']['chapters'] = new moodle_url('chapters.vtt') * @return string HTML code for embed */ public function embed($urls, $name, $width, $height, $options) {