aboutsummaryrefslogtreecommitdiffstats
path: root/librevideojs/js/cliplibrejs-playlists.js
diff options
context:
space:
mode:
authorHeckyel <heckyel@openmailbox.org>2017-01-28 19:00:18 -0500
committerHeckyel <heckyel@openmailbox.org>2017-01-28 19:00:18 -0500
commitfb993840a3e016d7b3ceabdf4b65750cce9ac221 (patch)
tree919d9425fb02f60faf81508b3392c22c92155a49 /librevideojs/js/cliplibrejs-playlists.js
parentbb0f3e1ed8a5de942cc65e5cd50b02a9b384ae33 (diff)
downloadlibrevideojs-html5-player-fb993840a3e016d7b3ceabdf4b65750cce9ac221.tar.lz
librevideojs-html5-player-fb993840a3e016d7b3ceabdf4b65750cce9ac221.tar.xz
librevideojs-html5-player-fb993840a3e016d7b3ceabdf4b65750cce9ac221.zip
Optimization of code
Diffstat (limited to 'librevideojs/js/cliplibrejs-playlists.js')
-rw-r--r--librevideojs/js/cliplibrejs-playlists.js160
1 files changed, 0 insertions, 160 deletions
diff --git a/librevideojs/js/cliplibrejs-playlists.js b/librevideojs/js/cliplibrejs-playlists.js
deleted file mode 100644
index bbee6c5..0000000
--- a/librevideojs/js/cliplibrejs-playlists.js
+++ /dev/null
@@ -1,160 +0,0 @@
-/*!
- *
- * @source: cliplibrejs-playlist.js
- *
- * @licstart The following is the entire license notice for the
- * JavaScript code in this page.
- *
- * Copyleft 2016 Heckyel - Cybersy
- *
- * The JavaScript code in this page is free software: you can
- * redistribute it and/or modify it under the terms of the GNU
- * General Public License (GNU GPL) as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option)
- * any later version. The code is distributed WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
- *
- * As additional permission under GNU GPL version 3 section 7, you
- * may distribute non-source (e.g., minimized or compacted) forms of
- * that code without the copy of the GNU GPL normally required by
- * section 4, provided you include this license notice and a URL
- * through which recipients can access the Corresponding Source.
- *
- * @licend The above is the entire license notice
- * for the JavaScript code in this page.
- *
- */
-function playList(options,arg){
- var player = this;
- player.pl = player.pl || {};
- var index = parseInt(options,10);
-
- player.pl._guessVideoType = function(video){
- var videoTypes = {
- 'webm' : 'video/webm',
- 'ogv' : 'video/ogg',
- 'mp4' : 'video/mp4',
- };
- var extension = video.split('.').pop();
-
- return videoTypes[extension] || '';
- };
-
- player.pl.init = function(videos, options) {
- options = options || {};
- player.pl.videos = [];
- player.pl.current = 0;
- player.on('ended', player.pl._videoEnd);
-
- if (options.getVideoSource) {
- player.pl.getVideoSource = options.getVideoSource;
- }
-
- player.pl._addVideos(videos);
- };
-
- player.pl._updatePoster = function(posterURL) {
- player.poster(posterURL);
- player.removeChild(player.posterImage);
- player.posterImage = player.addChild("posterImage");
- };
-
- player.pl._addVideos = function(videos){
- for (var i = 0, length = videos.length; i < length; i++){
- var aux = [];
- for (var j = 0, len = videos[i].src.length; j < len; j++){
- aux.push({
- type : player.pl._guessVideoType(videos[i].src[j]),
- src : videos[i].src[j]
- });
- }
- videos[i].src = aux;
- player.pl.videos.push(videos[i]);
- }
- };
-
- player.pl._nextPrev = function(func){
- var comparison, addendum;
-
- if (func === 'next'){
- comparison = player.pl.videos.length -1;
- addendum = 1;
- }
- else {
- comparison = 0;
- addendum = -1;
- }
-
- if (player.pl.current !== comparison){
- var newIndex = player.pl.current + addendum;
- player.pl._setVideo(newIndex);
- player.trigger(func, [player.pl.videos[newIndex]]);
- }
- };
-
- player.pl._setVideo = function(index){
- if (index < player.pl.videos.length){
- player.pl.current = index;
- player.pl.currentVideo = player.pl.videos[index];
-
- if (!player.paused()){
- player.pl._resumeVideo();
- }
-
- if (player.pl.getVideoSource) {
- player.pl.getVideoSource(player.pl.videos[index], function(src, poster) {
- player.pl._setVideoSource(src, poster);
- });
- } else {
- player.pl._setVideoSource(player.pl.videos[index].src, player.pl.videos[index].poster);
- }
- }
- };
-
- player.pl._setVideoSource = function(src, poster) {
- player.src(src);
- player.pl._updatePoster(poster);
- };
-
- player.pl._resumeVideo = function(){
- player.one('loadstart',function(){
- player.play();
- });
- };
-
- player.pl._videoEnd = function(){
- if (player.pl.current === player.pl.videos.length -1){
- player.trigger('lastVideoEnded');
- }
- else {
- player.pl._resumeVideo();
- player.next();
- }
- };
-
- if (options instanceof Array){
- player.pl.init(options, arg);
- player.pl._setVideo(0);
- return player;
- }
- else if (index === index){ // NaN
- player.pl._setVideo(index);
- return player;
- }
- else if (typeof options === 'string' && typeof player.pl[options] !== 'undefined'){
- player.pl[options].apply(player);
- return player;
- }
-}
-
-cliplibrejs.Player.prototype.next = function(){
- this.pl._nextPrev('next');
- return this;
-};
-cliplibrejs.Player.prototype.prev = function(){
- this.pl._nextPrev('prev');
- return this;
-};
-
-cliplibrejs.plugin('playList', playList);