Files
Testing/flowplayer1/flowplayer.min.js

7 lines
42 KiB
JavaScript
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
/*!
Flowplayer v5.4.1 (Friday, 26. April 2013 07:03PM) | flowplayer.org/license
*/
!function($){!function($){if(!$.browser){var b=$.browser={},ua=navigator.userAgent.toLowerCase(),match=/(chrome)[ \/]([\w.]+)/.exec(ua)||/(safari)[ \/]([\w.]+)/.exec(ua)||/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||ua.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];if(match[1]){b[match[1]]=true;b.version=match[2]||"0"}}}(jQuery);$(function(){if(typeof $.fn.flowplayer=="function"){$("video").parent(".flowplayer").flowplayer()}});var instances=[],extensions=[],UA=window.navigator.userAgent;window.flowplayer=function(fn){return $.isFunction(fn)?extensions.push(fn):typeof fn=="number"||fn===undefined?instances[fn||0]:$(fn).data("flowplayer")};$(window).on("beforeunload",function(){$.each(instances,function(i,api){if(api.conf.splash){api.unload()}else{api.bind("error",function(){$(".flowplayer.is-error .fp-message").remove()})}})});$.extend(flowplayer,{version:"5.4.1",engine:{},conf:{},support:{},defaults:{debug:false,disabled:false,engine:"html5",fullscreen:window==window.top,keyboard:true,ratio:9/16,flashfit:false,rtmp:0,splash:false,swf:"//releases.flowplayer.org/5.4.1/flowplayer.swf",speeds:[.25,.5,1,1.5,2],tooltip:true,volume:typeof localStorage=="object"&&!isNaN(localStorage.volume)?localStorage.volume||1:1,errors:["","Video loading aborted","Network error","Video not properly encoded","Video file not found","Unsupported video","Skin not found","SWF file not found","Subtitles not found","Invalid RTMP URL","Unsupported video format. Try installing Adobe Flash."],errorUrls:["","","","","","","","","","","http://get.adobe.com/flashplayer/"],playlist:[]}});var playerCount=1;$.fn.flowplayer=function(opts,callback){if(typeof opts=="string")opts={swf:opts};if($.isFunction(opts)){callback=opts;opts={}}return!opts&&this.data("flowplayer")||this.each(function(){var root=$(this).addClass("is-loading"),conf=$.extend({},flowplayer.defaults,flowplayer.conf,opts,root.data()),videoTag=$("video",root).addClass("fp-engine").removeAttr("controls"),urlResolver=videoTag.length?new URLResolver(videoTag):null,storage={},lastSeekPosition,engine;if(conf.playlist.length){var preload=videoTag.attr("preload");videoTag.remove();videoTag=$("<video />").addClass("fp-engine").appendTo(root).attr("preload",preload);if(typeof conf.playlist[0]==="string")videoTag.attr("src",conf.playlist[0]);else{$.each(conf.playlist[0],function(i,plObj){for(var type in plObj){if(plObj.hasOwnProperty(type)){videoTag.append($("<source />").attr({type:"video/"+type,src:plObj[type]}))}}})}urlResolver=new URLResolver(videoTag)}var oldApi=root.data("flowplayer");if(oldApi)oldApi.unload();root.data("fp-player_id",root.data("fp-player_id")||playerCount++);try{storage=window.localStorage||storage}catch(e){}var isRTL=this.currentStyle&&this.currentStyle["direction"]==="rtl"||window.getComputedStyle&&window.getComputedStyle(this,null).getPropertyValue("direction")==="rtl";if(isRTL)root.addClass("is-rtl");var api=oldApi||{conf:conf,currentSpeed:1,volumeLevel:conf.volume||storage.volume*1,video:{},disabled:false,finished:false,loading:false,muted:storage.muted=="true"||conf.muted,paused:false,playing:false,ready:false,splash:false,rtl:isRTL,load:function(video,callback){if(api.error||api.loading||api.disabled)return;video=urlResolver.resolve(video);$.extend(video,engine.pick(video.sources));if(video.src){var e=$.Event("load");root.trigger(e,[api,video,engine]);if(!e.isDefaultPrevented()){engine.load(video);if($.isFunction(video))callback=video;if(callback)root.one("ready",callback)}else{api.loading=false}}return api},pause:function(fn){if(api.ready&&!api.seeking&&!api.disabled&&!api.loading){engine.pause();api.one("pause",fn)}return api},resume:function(){if(api.ready&&api.paused&&!api.disabled){engine.resume();if(api.finished){api.trigger("resume");api.finished=false}}return api},toggle:function(){return api.ready?api.paused?api.resume():api.pause():api.load()},seek:function(time,callback){if(api.ready){if(typeof time=="boolean"){var delta=api.video.duration*.1;time=api.video.time+(time?delta:-d
function els(){return $(conf.query,root)}function active(){return $(conf.query+"."+klass,root)}player.play=function(i){if(i===undefined)player.resume();if(typeof i==="number"&&!player.conf.playlist[i])return player;else if(typeof i!="number")player.load.apply(null,arguments);player.unbind("resume.fromfirst");player.load(typeof player.conf.playlist[i]==="string"?player.conf.playlist[i].toString():player.conf.playlist[i].map(function(item){return $.extend({},item)}));return player};var indexForVideo=function(src,sources){var i,j;for(i=0;i<player.conf.playlist.length;i++){if(typeof player.conf.playlist[i]==="string"&&player.conf.playlist[i].indexOf(src.replace(/\.[^\.]+$/g,""))===0){return i}for(j=0;j<player.conf.playlist[i].length;j++){var source=player.conf.playlist[i][j];for(var type in source){if(source.hasOwnProperty(type)&&source[type]==src){return i}}}}if(sources&&sources.length){for(i=0;i<sources.length;i++){var found=indexForVideo(sources[i].src);if(found!=-1)return found}}return-1};var currentClipIndex=function(){return indexForVideo(player.video.src)};player.next=function(e){e&&e.preventDefault();var current=currentClipIndex();if(current!=-1){current=current===player.conf.playlist.length-1?0:current+1;player.play(current)}return player};player.prev=function(e){e&&e.preventDefault();var current=currentClipIndex();if(current!=-1){current=current===0?player.conf.playlist.length-1:current-1;player.play(current)}return player};$(".fp-next",root).click(player.next);$(".fp-prev",root).click(player.prev);if(conf.advance){root.unbind("finish.pl").bind("finish.pl",function(e,player){var next=indexForVideo(player.video.src,player.video.sources)+1;if(next<player.conf.playlist.length||conf.loop){next=next===player.conf.playlist.length?0:next;player.play(next)}else{root.addClass("is-playing");player.one("resume.fromfirst",function(){player.play(0);return false})}})}var playlistInitialized=false;if(player.conf.playlist.length){playlistInitialized=true;var plEl=root.find(".fp-playlist");if(!plEl.length){plEl=$('<div class="fp-playlist"></div>');$("video",root).after(plEl)}plEl.empty();$.each(player.conf.playlist,function(i,item){var href;if(typeof item==="string"){href=item}else{for(var key in item[0]){if(item[0].hasOwnProperty(key)){href=item[0][key];break}}}plEl.append('<a href="'+href+'"></a>')})}if(els().length){if(!playlistInitialized){player.conf.playlist=[];els().each(function(){var src=$(this).attr("href");player.conf.playlist.push(src)})}root.on("click",conf.query,function(e){e.preventDefault();var el=$(e.target).closest(conf.query);var toPlay=indexForVideo(el.attr("href"));if(toPlay!=-1){player.play(toPlay)}});var has_cuepoints=els().filter("[data-cuepoints]").length;player.bind("load",function(e,api,video){var prev=active().removeClass(klass),el=$("a[href*='"+video.src.replace(TYPE_RE,"")+".']",root).addClass(klass),clips=els(),index=clips.index(el),is_last=index==clips.length-1;root.removeClass("video"+clips.index(prev)).addClass("video"+index).toggleClass("last-video",is_last);video.index=api.video.index=index;video.is_last=api.video.is_last=is_last;if(has_cuepoints)player.cuepoints=el.data("cuepoints")}).bind("unload.pl",function(){active().toggleClass(klass)})}if(player.conf.playlist.length){player.conf.loop=false}});var CUE_RE=/ ?cue\d+ ?/;flowplayer(function(player,root){var lastTime=0;player.cuepoints=player.conf.cuepoints||[];function setClass(index){root[0].className=root[0].className.replace(CUE_RE," ");if(index>=0)root.addClass("cue"+index)}player.bind("progress",function(e,api,time){if(lastTime&&time-lastTime<.015)return lastTime=time;lastTime=time;var cues=player.cuepoints||[];for(var i=0,cue;i<cues.length;i++){cue=cues[i];if(!isNaN(cue))cue={time:cue};if(cue.time<0)cue.time=player.video.duration+cue.time;cue.index=i;if(Math.abs(cue.time-time)<.125*player.currentSpeed){setClass(i);root.trigger("cuepoint",[player,cue])}}}).bind("unload seek",setClass);if(player.conf.generate_cuepoints){player.bind("load",function(){$(".fp-cuepoint",root).remove()}).bind("ready",function(){var cues=player.cuepoints||[],dur