samvera_hls 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/samvera_hls/version.rb +1 -1
- data/vendor/assets/flash/mediaelement-flash-audio-ogg.swf +0 -0
- data/vendor/assets/flash/mediaelement-flash-audio.swf +0 -0
- data/vendor/assets/flash/mediaelement-flash-video-hls.swf +0 -0
- data/vendor/assets/flash/mediaelement-flash-video-mdash.swf +0 -0
- data/vendor/assets/flash/mediaelement-flash-video.swf +0 -0
- data/vendor/assets/images/mejs-controls.png +0 -0
- data/vendor/assets/images/mejs-controls.svg +1 -0
- data/vendor/assets/images/playlist-controls.svg +52 -0
- data/vendor/assets/javascripts/lang/ca.js +89 -0
- data/vendor/assets/javascripts/lang/cs.js +90 -0
- data/vendor/assets/javascripts/lang/de.js +90 -0
- data/vendor/assets/javascripts/lang/es.js +90 -0
- data/vendor/assets/javascripts/lang/fa.js +90 -0
- data/vendor/assets/javascripts/lang/fr.js +91 -0
- data/vendor/assets/javascripts/lang/hr.js +87 -0
- data/vendor/assets/javascripts/lang/hu.js +90 -0
- data/vendor/assets/javascripts/lang/it.js +90 -0
- data/vendor/assets/javascripts/lang/ja.js +90 -0
- data/vendor/assets/javascripts/lang/ko.js +90 -0
- data/vendor/assets/javascripts/lang/nl.js +91 -0
- data/vendor/assets/javascripts/lang/pl.js +90 -0
- data/vendor/assets/javascripts/lang/pt.js +92 -0
- data/vendor/assets/javascripts/lang/ro.js +90 -0
- data/vendor/assets/javascripts/lang/ru.js +90 -0
- data/vendor/assets/javascripts/lang/sk.js +90 -0
- data/vendor/assets/javascripts/lang/sv.js +89 -0
- data/vendor/assets/javascripts/lang/uk.js +89 -0
- data/vendor/assets/javascripts/lang/zh-cn.js +90 -0
- data/vendor/assets/javascripts/lang/zh.js +91 -0
- data/vendor/assets/javascripts/mediaelement-and-player.js +8497 -0
- data/vendor/assets/javascripts/playlist-i18n.js +149 -0
- data/vendor/assets/javascripts/playlist.js +348 -0
- data/vendor/assets/javascripts/renderers/dailymotion.js +415 -0
- data/vendor/assets/javascripts/renderers/dailymotion.min.js +12 -0
- data/vendor/assets/javascripts/renderers/facebook.js +361 -0
- data/vendor/assets/javascripts/renderers/facebook.min.js +12 -0
- data/vendor/assets/javascripts/renderers/soundcloud.js +306 -0
- data/vendor/assets/javascripts/renderers/soundcloud.min.js +12 -0
- data/vendor/assets/javascripts/renderers/twitch.js +374 -0
- data/vendor/assets/javascripts/renderers/twitch.min.js +12 -0
- data/vendor/assets/javascripts/renderers/vimeo.js +411 -0
- data/vendor/assets/javascripts/renderers/vimeo.min.js +12 -0
- data/vendor/assets/stylesheets/mediaelementplayer-legacy.css.erb +774 -0
- data/vendor/assets/stylesheets/mediaelementplayer.css.erb +774 -0
- data/vendor/assets/stylesheets/playlist.css.erb +229 -0
- metadata +46 -1
@@ -0,0 +1,149 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
if (mejs.i18n.ca !== undefined) {
|
4
|
+
mejs.i18n.ca['mejs.playlist'] = 'Llista de reproducció';
|
5
|
+
mejs.i18n.ca['mejs.playlist-prev'] = 'Anterior';
|
6
|
+
mejs.i18n.ca['mejs.playlist-next'] = 'Pròxim';
|
7
|
+
mejs.i18n.ca['mejs.playlist-loop'] = 'Bucle';
|
8
|
+
mejs.i18n.ca['mejs.playlist-shuffle'] = 'Barrejar';
|
9
|
+
}
|
10
|
+
if (mejs.i18n.cs !== undefined) {
|
11
|
+
mejs.i18n.cs['mejs.playlist'] = 'Seznam skladeb';
|
12
|
+
mejs.i18n.cs['mejs.playlist-prev'] = 'Předchozí';
|
13
|
+
mejs.i18n.cs['mejs.playlist-next'] = 'Další';
|
14
|
+
mejs.i18n.cs['mejs.playlist-loop'] = 'Smyčka';
|
15
|
+
mejs.i18n.cs['mejs.playlist-shuffle'] = 'Zamíchat';
|
16
|
+
}
|
17
|
+
if (mejs.i18n.de !== undefined) {
|
18
|
+
mejs.i18n.de['mejs.playlist'] = 'Wiedergabeliste';
|
19
|
+
mejs.i18n.de['mejs.playlist-prev'] = 'Bisherige';
|
20
|
+
mejs.i18n.de['mejs.playlist-next'] = 'Nächster';
|
21
|
+
mejs.i18n.de['mejs.playlist-loop'] = 'Schleife';
|
22
|
+
mejs.i18n.de['mejs.playlist-shuffle'] = 'Shuffle';
|
23
|
+
}
|
24
|
+
if (mejs.i18n.es !== undefined) {
|
25
|
+
mejs.i18n.es['mejs.playlist'] = 'Lista de Reproducción';
|
26
|
+
mejs.i18n.es['mejs.playlist-prev'] = 'Previo';
|
27
|
+
mejs.i18n.es['mejs.playlist-next'] = 'Siguiente';
|
28
|
+
mejs.i18n.es['mejs.playlist-loop'] = 'Ciclar';
|
29
|
+
mejs.i18n.es['mejs.playlist-shuffle'] = 'Mezclar';
|
30
|
+
}
|
31
|
+
if (mejs.i18n.fa !== undefined) {
|
32
|
+
mejs.i18n.fa['mejs.playlist'] = 'لیست پخش';
|
33
|
+
mejs.i18n.fa['mejs.playlist-prev'] = 'قبلی';
|
34
|
+
mejs.i18n.fa['mejs.playlist-next'] = 'بعد';
|
35
|
+
mejs.i18n.fa['mejs.playlist-loop'] = 'حلقه';
|
36
|
+
mejs.i18n.fa['mejs.playlist-shuffle'] = 'زدن';
|
37
|
+
}
|
38
|
+
if (mejs.i18n.fr !== undefined) {
|
39
|
+
mejs.i18n.fr['mejs.playlist'] = 'Playlist';
|
40
|
+
mejs.i18n.fr['mejs.playlist-prev'] = 'Précédent';
|
41
|
+
mejs.i18n.fr['mejs.playlist-next'] = 'Prochain';
|
42
|
+
mejs.i18n.fr['mejs.playlist-loop'] = 'Boucle';
|
43
|
+
mejs.i18n.fr['mejs.playlist-shuffle'] = 'Mélanger';
|
44
|
+
}
|
45
|
+
if (mejs.i18n.hr !== undefined) {
|
46
|
+
mejs.i18n.hr['mejs.playlist'] = 'Popis';
|
47
|
+
mejs.i18n.hr['mejs.playlist-prev'] = 'Prijašnji';
|
48
|
+
mejs.i18n.hr['mejs.playlist-next'] = 'Sljedeći';
|
49
|
+
mejs.i18n.hr['mejs.playlist-loop'] = 'Petlja';
|
50
|
+
mejs.i18n.hr['mejs.playlist-shuffle'] = 'Miješanje';
|
51
|
+
}
|
52
|
+
if (mejs.i18n.hu !== undefined) {
|
53
|
+
mejs.i18n.hu['mejs.playlist'] = 'Lejátszási lista';
|
54
|
+
mejs.i18n.hu['mejs.playlist-prev'] = 'Előző';
|
55
|
+
mejs.i18n.hu['mejs.playlist-next'] = 'Következő';
|
56
|
+
mejs.i18n.hu['mejs.playlist-loop'] = 'Hurok';
|
57
|
+
mejs.i18n.hu['mejs.playlist-shuffle'] = 'Keverés';
|
58
|
+
}
|
59
|
+
if (mejs.i18n.it !== undefined) {
|
60
|
+
mejs.i18n.it['mejs.playlist'] = 'Elenco di riproduzione';
|
61
|
+
mejs.i18n.it['mejs.playlist-prev'] = 'Precedente';
|
62
|
+
mejs.i18n.it['mejs.playlist-next'] = 'Prossimo';
|
63
|
+
mejs.i18n.it['mejs.playlist-loop'] = 'Ciclo continuo';
|
64
|
+
mejs.i18n.it['mejs.playlist-shuffle'] = 'Rimescolare';
|
65
|
+
}
|
66
|
+
if (mejs.i18n.ja !== undefined) {
|
67
|
+
mejs.i18n.ja['mejs.playlist'] = 'プレイリスト';
|
68
|
+
mejs.i18n.ja['mejs.playlist-prev'] = '前';
|
69
|
+
mejs.i18n.ja['mejs.playlist-next'] = '次';
|
70
|
+
mejs.i18n.ja['mejs.playlist-loop'] = 'ループ';
|
71
|
+
mejs.i18n.ja['mejs.playlist-shuffle'] = 'シャッフル';
|
72
|
+
}
|
73
|
+
if (mejs.i18n.ko !== undefined) {
|
74
|
+
mejs.i18n.ko['mejs.playlist'] = '재생 목록';
|
75
|
+
mejs.i18n.ko['mejs.playlist-prev'] = '너무 이른';
|
76
|
+
mejs.i18n.ko['mejs.playlist-next'] = '다음 것';
|
77
|
+
mejs.i18n.ko['mejs.playlist-loop'] = '고리';
|
78
|
+
mejs.i18n.ko['mejs.playlist-shuffle'] = '혼합';
|
79
|
+
}
|
80
|
+
if (mejs.i18n.nl !== undefined) {
|
81
|
+
mejs.i18n.nl['mejs.playlist'] = 'Afspeellijst';
|
82
|
+
mejs.i18n.nl['mejs.playlist-prev'] = 'Voorgaand';
|
83
|
+
mejs.i18n.nl['mejs.playlist-next'] = 'Volgende';
|
84
|
+
mejs.i18n.nl['mejs.playlist-loop'] = 'Lus';
|
85
|
+
mejs.i18n.nl['mejs.playlist-shuffle'] = 'Schuifelen';
|
86
|
+
}
|
87
|
+
if (mejs.i18n.pl !== undefined) {
|
88
|
+
mejs.i18n.pl['mejs.playlist'] = 'Playlistę';
|
89
|
+
mejs.i18n.pl['mejs.playlist-prev'] = 'Poprzedni';
|
90
|
+
mejs.i18n.pl['mejs.playlist-next'] = 'Następny';
|
91
|
+
mejs.i18n.pl['mejs.playlist-loop'] = 'Pętla';
|
92
|
+
mejs.i18n.pl['mejs.playlist-shuffle'] = 'Człapać';
|
93
|
+
}
|
94
|
+
if (mejs.i18n.pt !== undefined) {
|
95
|
+
mejs.i18n.pt['mejs.playlist'] = 'Lista de reprodução';
|
96
|
+
mejs.i18n.pt['mejs.playlist-prev'] = 'Anterior';
|
97
|
+
mejs.i18n.pt['mejs.playlist-next'] = 'Próximo';
|
98
|
+
mejs.i18n.pt['mejs.playlist-loop'] = 'Ciclar';
|
99
|
+
mejs.i18n.pt['mejs.playlist-shuffle'] = 'Baralhar';
|
100
|
+
}
|
101
|
+
if (mejs.i18n.ro !== undefined) {
|
102
|
+
mejs.i18n.ro['mejs.playlist'] = 'Lista de redare';
|
103
|
+
mejs.i18n.ro['mejs.playlist-prev'] = 'Anterior';
|
104
|
+
mejs.i18n.ro['mejs.playlist-next'] = 'Următor';
|
105
|
+
mejs.i18n.ca['mejs.playlist-loop'] = 'Buclă';
|
106
|
+
mejs.i18n.ca['mejs.playlist-shuffle'] = 'Amesteca';
|
107
|
+
}
|
108
|
+
if (mejs.i18n.ru !== undefined) {
|
109
|
+
mejs.i18n.ru['mejs.playlist'] = 'плейлист';
|
110
|
+
mejs.i18n.ru['mejs.playlist-prev'] = 'предыдущий';
|
111
|
+
mejs.i18n.ru['mejs.playlist-next'] = 'следующий';
|
112
|
+
mejs.i18n.ru['mejs.playlist-loop'] = 'петля';
|
113
|
+
mejs.i18n.ru['mejs.playlist-shuffle'] = 'шарканье';
|
114
|
+
}
|
115
|
+
if (mejs.i18n.sk !== undefined) {
|
116
|
+
mejs.i18n.sk['mejs.playlist'] = 'Playlist';
|
117
|
+
mejs.i18n.sk['mejs.playlist-prev'] = 'Predchádzajúca';
|
118
|
+
mejs.i18n.sk['mejs.playlist-next'] = 'Ďalšie';
|
119
|
+
mejs.i18n.sk['mejs.playlist-loop'] = 'Slučka';
|
120
|
+
mejs.i18n.sk['mejs.playlist-shuffle'] = 'Miešanie';
|
121
|
+
}
|
122
|
+
if (mejs.i18n.sv !== undefined) {
|
123
|
+
mejs.i18n.sv['mejs.playlist'] = 'Spellista';
|
124
|
+
mejs.i18n.sv['mejs.playlist-prev'] = 'Tidigare';
|
125
|
+
mejs.i18n.sv['mejs.playlist-next'] = 'Nästa';
|
126
|
+
mejs.i18n.sv['mejs.playlist-loop'] = 'Slinga';
|
127
|
+
mejs.i18n.sv['mejs.playlist-shuffle'] = 'Blanda';
|
128
|
+
}
|
129
|
+
if (mejs.i18n.uk !== undefined) {
|
130
|
+
mejs.i18n.uk['mejs.playlist'] = 'Плейлист';
|
131
|
+
mejs.i18n.uk['mejs.playlist-prev'] = 'Попередній';
|
132
|
+
mejs.i18n.uk['mejs.playlist-next'] = 'Далі';
|
133
|
+
mejs.i18n.uk['mejs.playlist-loop'] = 'Петля';
|
134
|
+
mejs.i18n.uk['mejs.playlist-shuffle'] = 'Перемішувати';
|
135
|
+
}
|
136
|
+
if (mejs.i18n.zh !== undefined) {
|
137
|
+
mejs.i18n.zh['mejs.playlist'] = '播放列表';
|
138
|
+
mejs.i18n.zh['mejs.playlist-prev'] = '以前';
|
139
|
+
mejs.i18n.zh['mejs.playlist-next'] = '下一個';
|
140
|
+
mejs.i18n.zh['mejs.playlist-loop'] = '循環';
|
141
|
+
mejs.i18n.zh['mejs.playlist-shuffle'] = '拖曳';
|
142
|
+
}
|
143
|
+
if (mejs.i18n['zh-CN'] !== undefined) {
|
144
|
+
mejs.i18n['zh-CN']['mejs.playlist'] = '播放列表';
|
145
|
+
mejs.i18n['zh-CN']['mejs.playlist-prev'] = '以前';
|
146
|
+
mejs.i18n['zh-CN']['mejs.playlist-next'] = '下一个';
|
147
|
+
mejs.i18n['zh-CN']['mejs.playlist-loop'] = '循环';
|
148
|
+
mejs.i18n['zh-CN']['mejs.playlist-shuffle'] = '拖曳';
|
149
|
+
}
|
@@ -0,0 +1,348 @@
|
|
1
|
+
/*!
|
2
|
+
* MediaElement.js
|
3
|
+
* http://www.mediaelementjs.com/
|
4
|
+
*
|
5
|
+
* Wrapper that mimics native HTML5 MediaElement (audio and video)
|
6
|
+
* using a variety of technologies (pure JavaScript, Flash, iframe)
|
7
|
+
*
|
8
|
+
* Copyright 2010-2017, John Dyer (http://j.hn/)
|
9
|
+
* License: MIT
|
10
|
+
*
|
11
|
+
*/(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
mejs.i18n.en['mejs.playlist'] = 'Toggle Playlist';
|
15
|
+
mejs.i18n.en['mejs.playlist-prev'] = 'Previous';
|
16
|
+
mejs.i18n.en['mejs.playlist-next'] = 'Next';
|
17
|
+
mejs.i18n.en['mejs.playlist-loop'] = 'Loop';
|
18
|
+
mejs.i18n.en['mejs.playlist-shuffle'] = 'Shuffle';
|
19
|
+
|
20
|
+
Object.assign(mejs.MepDefaults, {
|
21
|
+
playlist: [],
|
22
|
+
|
23
|
+
showPlaylist: true,
|
24
|
+
|
25
|
+
autoClosePlaylist: false,
|
26
|
+
|
27
|
+
prevText: null,
|
28
|
+
|
29
|
+
nextText: null,
|
30
|
+
|
31
|
+
loopText: null,
|
32
|
+
|
33
|
+
shuffleText: null,
|
34
|
+
|
35
|
+
playlistTitle: null,
|
36
|
+
|
37
|
+
currentMessage: null
|
38
|
+
});
|
39
|
+
|
40
|
+
Object.assign(MediaElementPlayer.prototype, {
|
41
|
+
buildplaylist: function buildplaylist(player, controls, layers, media) {
|
42
|
+
|
43
|
+
var defaultPlaylistTitle = mejs.i18n.t('mejs.playlist'),
|
44
|
+
playlistTitle = mejs.Utils.isString(player.options.playlistTitle) ? player.options.playlistTitle : defaultPlaylistTitle;
|
45
|
+
|
46
|
+
if (player.createPlayList_()) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
|
50
|
+
player.currentPlaylistItem = 0;
|
51
|
+
player.originalControlsIndex = controls.style.zIndex;
|
52
|
+
controls.style.zIndex = 5;
|
53
|
+
|
54
|
+
player.endedCallback = function () {
|
55
|
+
if (player.currentPlaylistItem < player.listItems.length) {
|
56
|
+
player.setSrc(player.playlist[++player.currentPlaylistItem]);
|
57
|
+
player.load();
|
58
|
+
setTimeout(function () {
|
59
|
+
player.play();
|
60
|
+
}, 200);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
|
64
|
+
media.addEventListener('ended', player.endedCallback);
|
65
|
+
|
66
|
+
if (!player.isVideo) {
|
67
|
+
var currentItem = document.createElement('div'),
|
68
|
+
audioCallback = function audioCallback() {
|
69
|
+
currentItem.innerHTML = '';
|
70
|
+
if (typeof player.playlist[player.currentPlaylistItem]['data-playlist-thumbnail'] !== 'undefined') {
|
71
|
+
currentItem.innerHTML += '<img tabindex="-1" src="' + player.playlist[player.currentPlaylistItem]['data-playlist-thumbnail'] + '">';
|
72
|
+
}
|
73
|
+
|
74
|
+
currentItem.innerHTML += '<p>' + player.options.currentMessage + ' <span class="' + player.options.classPrefix + 'playlist-current-title">' + player.playlist[player.currentPlaylistItem].title + '</span>';
|
75
|
+
if (typeof player.playlist[player.currentPlaylistItem].description !== 'undefined') {
|
76
|
+
currentItem.innerHTML += ' - <span class="' + player.options.classPrefix + 'playlist-current-description">' + player.playlist[player.currentPlaylistItem].description + '</span>';
|
77
|
+
}
|
78
|
+
currentItem.innerHTML += '</p>';
|
79
|
+
player.resetSize();
|
80
|
+
};
|
81
|
+
currentItem.className = player.options.classPrefix + 'playlist-current ' + player.options.classPrefix + 'layer';
|
82
|
+
audioCallback();
|
83
|
+
layers.insertBefore(currentItem, layers.firstChild);
|
84
|
+
media.addEventListener('play', audioCallback);
|
85
|
+
}
|
86
|
+
|
87
|
+
if (player.options.showPlaylist) {
|
88
|
+
player.playlistLayer = document.createElement('div');
|
89
|
+
player.playlistLayer.className = player.options.classPrefix + 'playlist-layer ' + player.options.classPrefix + 'layer ' + (player.isVideo ? player.options.classPrefix + 'playlist-hidden' : '') + ' ' + player.options.classPrefix + 'playlist-selector';
|
90
|
+
player.playlistLayer.innerHTML = '<ul class="' + player.options.classPrefix + 'playlist-selector-list"></ul>';
|
91
|
+
layers.insertBefore(player.playlistLayer, layers.firstChild);
|
92
|
+
|
93
|
+
for (var i = 0, total = player.listItems.length; i < total; i++) {
|
94
|
+
player.playlistLayer.querySelector('ul').innerHTML += player.listItems[i];
|
95
|
+
}
|
96
|
+
|
97
|
+
if (player.isVideo) {
|
98
|
+
player.playlistButton = document.createElement('div');
|
99
|
+
player.playlistButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'playlist-button';
|
100
|
+
player.playlistButton.innerHTML = '<button type="button" aria-controls="' + player.id + '" title="' + playlistTitle + '" aria-label="' + playlistTitle + '" tabindex="0"></button>';
|
101
|
+
player.playlistButton.addEventListener('click', function () {
|
102
|
+
mejs.Utils.toggleClass(player.playlistLayer, player.options.classPrefix + 'playlist-hidden');
|
103
|
+
});
|
104
|
+
player.addControlElement(player.playlistButton, 'playlist');
|
105
|
+
} else {
|
106
|
+
var _items = player.playlistLayer.querySelectorAll('li');
|
107
|
+
|
108
|
+
if (_items.length <= 10) {
|
109
|
+
var height = 0;
|
110
|
+
for (var _i = 0, _total = _items.length; _i < _total; _i++) {
|
111
|
+
height += _items[_i].offsetHeight;
|
112
|
+
}
|
113
|
+
player.container.style.height = height + 'px';
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
var items = player.playlistLayer.querySelectorAll('.' + player.options.classPrefix + 'playlist-selector-list-item'),
|
118
|
+
inputs = player.playlistLayer.querySelectorAll('input[type=radio]');
|
119
|
+
|
120
|
+
for (var _i2 = 0, _total2 = inputs.length; _i2 < _total2; _i2++) {
|
121
|
+
inputs[_i2].disabled = false;
|
122
|
+
inputs[_i2].addEventListener('click', function () {
|
123
|
+
var radios = player.playlistLayer.querySelectorAll('input[type="radio"]'),
|
124
|
+
selected = player.playlistLayer.querySelectorAll('.' + player.options.classPrefix + 'playlist-selected');
|
125
|
+
|
126
|
+
for (var j = 0, total2 = radios.length; j < total2; j++) {
|
127
|
+
radios[j].checked = false;
|
128
|
+
}
|
129
|
+
for (var _j = 0, _total3 = selected.length; _j < _total3; _j++) {
|
130
|
+
mejs.Utils.removeClass(selected[_j], player.options.classPrefix + 'playlist-selected');
|
131
|
+
selected[_j].querySelector('label').querySelector('span').remove();
|
132
|
+
}
|
133
|
+
|
134
|
+
this.checked = true;
|
135
|
+
this.closest('.' + player.options.classPrefix + 'playlist-selector-list-item').querySelector('label').innerHTML = '<span>\u25B6</span> ' + this.closest('.' + player.options.classPrefix + 'playlist-selector-list-item').querySelector('label').innerHTML;
|
136
|
+
mejs.Utils.addClass(this.closest('.' + player.options.classPrefix + 'playlist-selector-list-item'), player.options.classPrefix + 'playlist-selected');
|
137
|
+
player.currentPlaylistItem = this.getAttribute('data-playlist-index');
|
138
|
+
player.setSrc(this.value);
|
139
|
+
player.load();
|
140
|
+
player.play();
|
141
|
+
|
142
|
+
if (player.isVideo && player.options.autoClosePlaylist === true) {
|
143
|
+
mejs.Utils.toggleClass(player.playlistLayer, player.options.classPrefix + 'playlist-hidden');
|
144
|
+
}
|
145
|
+
});
|
146
|
+
}
|
147
|
+
|
148
|
+
for (var _i3 = 0, _total4 = items.length; _i3 < _total4; _i3++) {
|
149
|
+
items[_i3].addEventListener('click', function () {
|
150
|
+
var radio = mejs.Utils.siblings(this.querySelector('.' + player.options.classPrefix + 'playlist-selector-label'), function (el) {
|
151
|
+
return el.tagName === 'INPUT';
|
152
|
+
})[0],
|
153
|
+
event = mejs.Utils.createEvent('click', radio);
|
154
|
+
radio.dispatchEvent(event);
|
155
|
+
});
|
156
|
+
}
|
157
|
+
|
158
|
+
player.keydownCallback = function (e) {
|
159
|
+
var event = mejs.Utils.createEvent('click', e.target);
|
160
|
+
e.target.dispatchEvent(event);
|
161
|
+
return false;
|
162
|
+
};
|
163
|
+
|
164
|
+
player.playlistLayer.addEventListener('keydown', function (e) {
|
165
|
+
var keyCode = e.which || e.keyCode || 0;
|
166
|
+
if (~[13, 32, 38, 40].indexOf(keyCode)) {
|
167
|
+
player.keydownCallback(e);
|
168
|
+
}
|
169
|
+
});
|
170
|
+
} else {
|
171
|
+
mejs.Utils.addClass(player.container, player.options.classPrefix + 'no-playlist');
|
172
|
+
}
|
173
|
+
},
|
174
|
+
cleanplaylist: function cleanplaylist(player, controls, layers, media) {
|
175
|
+
media.removeEventListener('ended', player.endedCallback);
|
176
|
+
},
|
177
|
+
buildprevtrack: function buildprevtrack(player) {
|
178
|
+
|
179
|
+
var defaultPrevTitle = mejs.i18n.t('mejs.playlist-prev'),
|
180
|
+
prevTitle = mejs.Utils.isString(player.options.prevText) ? player.options.prevText : defaultPrevTitle;
|
181
|
+
player.prevButton = document.createElement('div');
|
182
|
+
player.prevButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'prev-button';
|
183
|
+
player.prevButton.innerHTML = '<button type="button" aria-controls="' + player.id + '" title="' + prevTitle + '" aria-label="' + prevTitle + '" tabindex="0"></button>';
|
184
|
+
|
185
|
+
player.prevPlaylistCallback = function () {
|
186
|
+
if (player.playlist[--player.currentPlaylistItem]) {
|
187
|
+
player.setSrc(player.playlist[player.currentPlaylistItem].src);
|
188
|
+
player.load();
|
189
|
+
player.play();
|
190
|
+
} else {
|
191
|
+
++player.currentPlaylistItem;
|
192
|
+
}
|
193
|
+
};
|
194
|
+
|
195
|
+
player.prevButton.addEventListener('click', player.prevPlaylistCallback);
|
196
|
+
player.addControlElement(player.prevButton, 'prevtrack');
|
197
|
+
},
|
198
|
+
cleanprevtrack: function cleanprevtrack(player) {
|
199
|
+
player.prevButton.removeEventListener('click', player.prevPlaylistCallback);
|
200
|
+
},
|
201
|
+
buildnexttrack: function buildnexttrack(player) {
|
202
|
+
var defaultNextTitle = mejs.i18n.t('mejs.playlist-next'),
|
203
|
+
nextTitle = mejs.Utils.isString(player.options.nextText) ? player.options.nextText : defaultNextTitle;
|
204
|
+
player.nextButton = document.createElement('div');
|
205
|
+
player.nextButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'next-button';
|
206
|
+
player.nextButton.innerHTML = '<button type="button" aria-controls="' + player.id + '" title="' + nextTitle + '" aria-label="' + nextTitle + '" tabindex="0"></button>';
|
207
|
+
|
208
|
+
player.nextPlaylistCallback = function () {
|
209
|
+
if (player.playlist[++player.currentPlaylistItem]) {
|
210
|
+
player.setSrc(player.playlist[player.currentPlaylistItem].src);
|
211
|
+
player.load();
|
212
|
+
player.play();
|
213
|
+
} else {
|
214
|
+
--player.currentPlaylistItem;
|
215
|
+
}
|
216
|
+
};
|
217
|
+
|
218
|
+
player.nextButton.addEventListener('click', player.nextPlaylistCallback);
|
219
|
+
player.addControlElement(player.nextButton, 'nexttrack');
|
220
|
+
},
|
221
|
+
cleannexttrack: function cleannexttrack(player) {
|
222
|
+
player.nextButton.removeEventListener('click', player.nextPlaylistCallback);
|
223
|
+
},
|
224
|
+
buildloop: function buildloop(player) {
|
225
|
+
var defaultLoopTitle = mejs.i18n.t('mejs.playlist-loop'),
|
226
|
+
loopTitle = mejs.Utils.isString(player.options.loopText) ? player.options.loopText : defaultLoopTitle;
|
227
|
+
|
228
|
+
player.loopButton = document.createElement('div');
|
229
|
+
player.loopButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'loop-button ' + (player.options.loop ? player.options.classPrefix + 'loop-on' : player.options.classPrefix + 'loop-off');
|
230
|
+
player.loopButton.innerHTML = '<button type="button" aria-controls="' + player.id + '" title="' + loopTitle + '" aria-label="' + loopTitle + '" tabindex="0"></button>';
|
231
|
+
player.loopCallback = function () {
|
232
|
+
player.options.loop = !player.options.loop;
|
233
|
+
if (player.options.loop) {
|
234
|
+
mejs.Utils.removeClass(player.loopButton, player.options.classPrefix + 'loop-off');
|
235
|
+
mejs.Utils.addClass(player.loopButton, player.options.classPrefix + 'loop-on');
|
236
|
+
} else {
|
237
|
+
mejs.Utils.removeClass(player.loopButton, player.options.classPrefix + 'loop-on');
|
238
|
+
mejs.Utils.addClass(player.loopButton, player.options.classPrefix + 'loop-off');
|
239
|
+
}
|
240
|
+
};
|
241
|
+
|
242
|
+
player.loopButton.addEventListener('click', player.loopCallback);
|
243
|
+
player.addControlElement(player.loopButton, 'loop');
|
244
|
+
},
|
245
|
+
cleanloop: function cleanloop(player) {
|
246
|
+
player.loopButton.removeEventListener('click', player.loopCallback);
|
247
|
+
},
|
248
|
+
buildshuffle: function buildshuffle(player) {
|
249
|
+
var defaultShuffleTitle = mejs.i18n.t('mejs.playlist-shuffle'),
|
250
|
+
shuffleTitle = mejs.Utils.isString(player.options.shuffleText) ? player.options.shuffleText : defaultShuffleTitle;
|
251
|
+
player.shuffleButton = document.createElement('div');
|
252
|
+
player.shuffleButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'shuffle-button ' + player.options.classPrefix + 'shuffle-off';
|
253
|
+
player.shuffleButton.innerHTML = '<button type="button" aria-controls="' + player.id + '" title="' + shuffleTitle + '" aria-label="' + shuffleTitle + '" tabindex="0"></button>';
|
254
|
+
player.shuffleButton.style.display = 'none';
|
255
|
+
player.media.addEventListener('play', function () {
|
256
|
+
player.shuffleButton.style.display = '';
|
257
|
+
player.resetSize();
|
258
|
+
});
|
259
|
+
|
260
|
+
var enabled = false,
|
261
|
+
playedItems = [];
|
262
|
+
var randomizeCallback = function randomizeCallback() {
|
263
|
+
if (!player.options.loop) {
|
264
|
+
var randomItem = Math.floor(Math.random() * player.playlist.length);
|
265
|
+
if (playedItems.indexOf(randomItem) === -1) {
|
266
|
+
player.setSrc(player.playlist[randomItem].src);
|
267
|
+
player.load();
|
268
|
+
player.play();
|
269
|
+
player.currentPlaylistItem = randomItem;
|
270
|
+
playedItems.push(randomItem);
|
271
|
+
} else if (playedItems.length < player.playlist.length) {
|
272
|
+
player.shuffleCallback();
|
273
|
+
} else if (playedItems.length < player.playlist.length) {
|
274
|
+
playedItems = [];
|
275
|
+
player.currentPlaylistItem = randomItem;
|
276
|
+
playedItems.push(randomItem);
|
277
|
+
}
|
278
|
+
}
|
279
|
+
};
|
280
|
+
|
281
|
+
player.shuffleCallback = function () {
|
282
|
+
if (!enabled) {
|
283
|
+
mejs.Utils.removeClass(player.shuffleButton, player.options.classPrefix + 'shuffle-off');
|
284
|
+
mejs.Utils.addClass(player.shuffleButton, player.options.classPrefix + 'shuffle-on');
|
285
|
+
enabled = true;
|
286
|
+
player.media.addEventListener('ended', randomizeCallback);
|
287
|
+
} else {
|
288
|
+
mejs.Utils.removeClass(player.shuffleButton, player.options.classPrefix + 'shuffle-on');
|
289
|
+
mejs.Utils.addClass(player.shuffleButton, player.options.classPrefix + 'shuffle-off');
|
290
|
+
enabled = false;
|
291
|
+
player.media.removeEventListener('ended', randomizeCallback);
|
292
|
+
}
|
293
|
+
};
|
294
|
+
|
295
|
+
player.shuffleButton.addEventListener('click', player.shuffleCallback);
|
296
|
+
player.addControlElement(player.shuffleButton, 'shuffle');
|
297
|
+
},
|
298
|
+
cleanshuffle: function cleanshuffle(player) {
|
299
|
+
player.shuffleButton.removeEventListener('click', player.shuffleCallback);
|
300
|
+
},
|
301
|
+
createPlayList_: function createPlayList_() {
|
302
|
+
var t = this;
|
303
|
+
|
304
|
+
t.playlist = t.options.playlist.length ? t.options.playlist : [];
|
305
|
+
|
306
|
+
if (!t.playlist.length) {
|
307
|
+
var children = t.mediaFiles || t.media.originalNode.children;
|
308
|
+
|
309
|
+
for (var i = 0, total = children.length; i < total; i++) {
|
310
|
+
var childNode = children[i];
|
311
|
+
|
312
|
+
if (childNode.tagName.toLowerCase() === 'source') {
|
313
|
+
(function () {
|
314
|
+
var elements = {};
|
315
|
+
Array.prototype.slice.call(childNode.attributes).forEach(function (item) {
|
316
|
+
elements[item.name] = item.value;
|
317
|
+
});
|
318
|
+
|
319
|
+
if (elements.src && elements.type && elements.title) {
|
320
|
+
elements.type = mejs.Utils.formatType(elements.src, elements.type);
|
321
|
+
t.playlist.push(elements);
|
322
|
+
}
|
323
|
+
})();
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}
|
327
|
+
|
328
|
+
if (t.playlist.length < 2) {
|
329
|
+
return;
|
330
|
+
}
|
331
|
+
|
332
|
+
t.listItems = [];
|
333
|
+
for (var _i4 = 0, _total5 = t.playlist.length; _i4 < _total5; _i4++) {
|
334
|
+
var element = t.playlist[_i4],
|
335
|
+
item = document.createElement('li'),
|
336
|
+
id = t.id + '_playlist_item_' + _i4,
|
337
|
+
thumbnail = element['data-playlist-thumbnail'] ? '<div class="' + t.options.classPrefix + 'playlist-item-thumbnail"><img tabindex="-1" src="' + element['data-playlist-thumbnail'] + '"></div>' : '',
|
338
|
+
description = element['data-playlist-description'] ? '<div class="' + t.options.classPrefix + 'playlist-item-description">' + element['data-playlist-description'] + '</div>' : '';
|
339
|
+
item.tabIndex = 0;
|
340
|
+
item.className = t.options.classPrefix + 'playlist-selector-list-item' + (_i4 === 0 ? ' ' + t.options.classPrefix + 'playlist-selected' : '');
|
341
|
+
item.innerHTML = '<div class="' + t.options.classPrefix + 'playlist-item-inner">' + ('' + thumbnail) + ('<div class="' + t.options.classPrefix + 'playlist-item-content">') + ('<div><input type="radio" class="' + t.options.classPrefix + 'playlist-selector-input" ') + ('name="' + t.id + '_playlist" id="' + id + '" data-playlist-index="' + _i4 + '" value="' + element.src + '" disabled>') + ('<label class="' + t.options.classPrefix + 'playlist-selector-label" ') + ('for="' + id + '">' + (_i4 === 0 ? '<span>\u25B6</span> ' : '') + (element.title || _i4) + '</label></div>' + description + '</div></div>');
|
342
|
+
|
343
|
+
t.listItems.push(item.outerHTML);
|
344
|
+
}
|
345
|
+
}
|
346
|
+
});
|
347
|
+
|
348
|
+
},{}]},{},[1]);
|