diff --git a/lib/bigvideo.min.js b/lib/bigvideo.min.js new file mode 100644 index 0000000..67ad7e4 --- /dev/null +++ b/lib/bigvideo.min.js @@ -0,0 +1 @@ +!function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery","videojs","imagesloaded","jquery-ui"],i):i(jQuery,videojs)}(function(i,o){i.BigVideo=function(e){function t(){var o=I.container.outerWidth()i("body").css("height","auto").height()?"100%":"auto"),b>t?"video"==v?(l.width(e*b).height(e),I.shrinkable?i(u).css("top",-(o/b-e)/2).css("left",0).css("height",o/b):i(u).css("top",0).css("left",-(e*b-o)/2).css("height",e),i(u+"_html5_api").css("width",e*b).css("height",e),i(u+"_flash_api").css("width",e*b).css("height",e)):i("#big-video-image").css({width:"auto",height:e,top:0,left:-(e*b-o)/2}):"video"==v?(l.width(o).height(o/b),i(u).css("top",-(o/b-e)/2).css("left",0).css("height",o/b),i(u+"_html5_api").css("width",i(u+"_html5_api").parent().width()+"px").css("height","auto"),i(u+"_flash_api").css("width",o).css("height",o/b)):i("#big-video-image").css({width:o,height:"auto",top:-(o/b-e)/2,left:0})}function d(){var o='
';I.container.append(o),i("#big-video-control-container").css("display","none"),i("#big-video-control-timer").css("display","none"),i("#big-video-control-track").slider({animate:!0,step:.01,slide:function(o,e){_=!0,i("#big-video-control-progress").css("width",e.value-.16+"%"),l.currentTime(e.value/100*l.duration())},stop:function(i,o){_=!1,l.currentTime(o.value/100*l.duration())}}),i("#big-video-control-bar").click(function(o){l.currentTime(o.offsetX/i(this).width()*l.duration())}),i("#big-video-control-play").click(function(i){i.preventDefault(),n("toggle")}),l.on("timeupdate",function(){if(!_&&l.currentTime()/l.duration()){var o=l.currentTime(),e=Math.floor(o/60),t=Math.floor(o)-60*e;10>t&&(t="0"+t);var d=l.currentTime()/l.duration()*100;i("#big-video-control-track").slider("value",d),i("#big-video-control-progress").css("width",d-.16+"%"),i("#big-video-control-timer").text(e+":"+t+"/"+m)}})}function n(o){var e=o||"toggle";"toggle"==e&&(e=k?"pause":"play"),"pause"==e?(l.pause(),i("#big-video-control-play").css("background-position","-16px"),k=!1):"play"==e?(l.play(),i("#big-video-control-play").css("background-position","0"),k=!0):"skip"==e&&s()}function a(){l.play(),I.container.off("click",a)}function s(){g++,g===L.length&&(g=0),r(L[g])}function r(o){i(u).css("display","block"),v="video",l.src(o),k=!0,j?(i("#big-video-control-container").css("display","none"),l.ready(function(){l.volume(0)}),doLoop=!0):(i("#big-video-control-container").css("display","block"),l.ready(function(){l.volume(y)}),doLoop=!1),i("#big-video-image").css("display","none"),i(u).css("display","block")}function c(o){i("#big-video-image").remove(),l.pause(),i(u).css("display","none"),i("#big-video-control-container").css("display","none"),v="image";var e=i(''),b=(i(""),16/9),m=0,y=.8,w=!1,_=!1,k=!1,x=!1,j=!1,L=[],I=i.extend({},h,e);return p.init=function(){if(!w){I.container.prepend(f);var e=I.forceAutoplay?"autoplay":"";l=i('"),l.css("position","absolute"),f.append(l);var n=["html5","flash"],r=navigator.userAgent.toLowerCase(),c=-1!=r.indexOf("firefox");I.useFlashForFirefox&&c&&(n=["flash","html5"]),l=o(u.substr(1),{controls:!1,autoplay:!0,preload:"auto",techOrder:n}),I.controls&&d(),t(),w=!0,k=!1,I.forceAutoplay&&i("body").on("click",a),i("#big-video-vid_flash_api").attr("scale","noborder").attr("width","100%").attr("height","100%"),i(window).on("resize.bigvideo",function(){t()}),l.on("loadedmetadata",function(o){b=document.getElementById("big-video-vid_flash_api")?document.getElementById("big-video-vid_flash_api").vjs_getProperty("videoWidth")/document.getElementById("big-video-vid_flash_api").vjs_getProperty("videoHeight"):i("#big-video-vid_html5_api").prop("videoWidth")/i("#big-video-vid_html5_api").prop("videoHeight"),t();var e=Math.round(l.duration()),d=Math.floor(e/60),n=e-60*d;10>n&&(n="0"+n),m=d+":"+n}),l.on("ended",function(){I.doLoop&&(l.currentTime(0),l.play()),x&&s()})}},p.show=function(o,e){if(void 0===e&&(e={}),j=e.ambient===!0,(j||e.doLoop)&&(I.doLoop=!0),"string"==typeof o){var t=o.lastIndexOf("?")>0?o.substring(o.lastIndexOf(".")+1,o.lastIndexOf("?")):o.substring(o.lastIndexOf(".")+1);"jpg"==t||"gif"==t||"png"==t?c(o):("mp4"==t||"ogg"==t||"ogv"==t||"webm"==t)&&(r(o),e.onShown&&e.onShown(),x=!1)}else if(i.isArray(o))r(o);else{if("object"!=typeof o||!o.src||!o.type)throw"BigVideo.show received invalid input for parameter source";r([o])}},p.showPlaylist=function(o,e){if(!i.isArray(o))throw"BigVideo.showPlaylist parameter files accepts only arrays";void 0===e&&(e={}),j=e.ambient===!0,(j||e.doLoop)&&(I.doLoop=!0),L=o,g=0,this.show(L[g]),e.onShown&&e.onShown(),x=!0},p.getPlayer=function(){return l},p.remove=p.dispose=function(){w=!1,f.remove(),i(window).off("resize.bigvideo"),l&&(l.off("loadedmetadata"),l.off("ended"),l.dispose())},p.triggerPlayer=function(i){n(i)},p}});