aboutsummaryrefslogtreecommitdiffstats
path: root/librevideojs/js/cliplibrejs-playlists.min.js
blob: 37f8e75508fcbbd7e3c91d28dc17d729aea6cb4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*!
 *
 * @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(c,a){var d=this;d.pl=d.pl||{};var b=parseInt(c,10);d.pl._guessVideoType=function(e){var f={webm:"video/webm",ogv:"video/ogg",mp4:"video/mp4",};var g=e.split(".").pop();return f[g]||""};d.pl.init=function(f,e){e=e||{};d.pl.videos=[];d.pl.current=0;d.on("ended",d.pl._videoEnd);if(e.getVideoSource){d.pl.getVideoSource=e.getVideoSource}d.pl._addVideos(f)};d.pl._updatePoster=function(e){d.poster(e);d.removeChild(d.posterImage);d.posterImage=d.addChild("posterImage")};d.pl._addVideos=function(k){for(var h=0,l=k.length;h<l;h++){var f=[];for(var g=0,e=k[h].src.length;g<e;g++){f.push({type:d.pl._guessVideoType(k[h].src[g]),src:k[h].src[g]})}k[h].src=f;d.pl.videos.push(k[h])}};d.pl._nextPrev=function(g){var h,f;if(g==="next"){h=d.pl.videos.length-1;f=1}else{h=0;f=-1}if(d.pl.current!==h){var e=d.pl.current+f;d.pl._setVideo(e);d.trigger(g,[d.pl.videos[e]])}};d.pl._setVideo=function(e){if(e<d.pl.videos.length){d.pl.current=e;d.pl.currentVideo=d.pl.videos[e];if(!d.paused()){d.pl._resumeVideo()}if(d.pl.getVideoSource){d.pl.getVideoSource(d.pl.videos[e],function(f,g){d.pl._setVideoSource(f,g)})}else{d.pl._setVideoSource(d.pl.videos[e].src,d.pl.videos[e].poster)}}};d.pl._setVideoSource=function(e,f){d.src(e);d.pl._updatePoster(f)};d.pl._resumeVideo=function(){d.one("loadstart",function(){d.play()})};d.pl._videoEnd=function(){if(d.pl.current===d.pl.videos.length-1){d.trigger("lastVideoEnded")}else{d.pl._resumeVideo();d.next()}};if(c instanceof Array){d.pl.init(c,a);d.pl._setVideo(0);return d}else{if(b===b){d.pl._setVideo(b);return d}else{if(typeof c==="string"&&typeof d.pl[c]!=="undefined"){d.pl[c].apply(d);return d}}}}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);