( function( $ ) { jQuery.html5_video_player = { name: "jquery.mb.html5_video_player", author: "mageewp.com", version: "1.0.8", build: "392", defaults: { containment: "body", ratio: "16/9", // "16/9" or "4/3" mp4URL: null, ogvURL: null, webmURL: null, startAt: 0, stopAt: 0, autoPlay: true, fadeTime: 1000, vol: 50, // 1 to 100 addRaster: false, opacity: 1, mute: true, loop: true, showControls: true, show_vimeo_logo: true, stopMovieOnBlur: true, realfullscreen: true, mobileFallbackImage: null, gaTrack: false, optimizeDisplay: true, mask: false, align: "center,center", // top,bottom,left,right onReady: function( player ) {} }, /** * @fontface icons * */ controls: { play: "P", pause: "p", mute: "M", unmute: "A", fullscreen: "O", showSite: "R", logo: "V" }, buildPlayer: function( options ) { var isIframe = function() { var isIfr = false; try { if( self.location.href != top.location.href ) isIfr = true; } catch( e ) { isIfr = true; } return isIfr; }; return this.each( function() { var html5_video_player = this; var $html5_video_player = jQuery( html5_video_player ); html5_video_player.loop = 0; html5_video_player.opt = {}; html5_video_player.state = {}; html5_video_player.id = html5_video_player.id || "YTP_" + new Date().getTime(); $html5_video_player.addClass( "html5_video_player" ); var property = $html5_video_player.data( "property" ) && typeof $html5_video_player.data( "property" ) == "string" ? eval( '(' + $html5_video_player.data( "property" ) + ')' ) : $html5_video_player.data( "property" ); jQuery.extend( html5_video_player.opt, jQuery.html5_video_player.defaults, options, property ); html5_video_player.opt.ratio = html5_video_player.opt.ratio == "auto" ? "16/9" : html5_video_player.opt.ratio; html5_video_player.isRetina = ( window.retina || window.devicePixelRatio > 1 ); html5_video_player.canGoFullScreen = !( jQuery.browser.msie || jQuery.browser.opera || isIframe() ); if( !html5_video_player.canGoFullScreen ) html5_video_player.opt.realfullscreen = false; html5_video_player.isAlone = false; html5_video_player.hasFocus = true; html5_video_player.mp4URL = this.opt.mp4URL ? this.opt.mp4URL : '#'; html5_video_player.ogvURL = this.opt.ogvURL ? this.opt.ogvURL : '#'; html5_video_player.webmURL = this.opt.webmURL ? this.opt.webmURL : '#'; html5_video_player.isSelf = html5_video_player.opt.containment == "self"; html5_video_player.opt.containment = html5_video_player.opt.containment == "self" ? jQuery( this ) : jQuery( html5_video_player.opt.containment ); html5_video_player.isBackground = html5_video_player.opt.containment.is( "body" ); if( html5_video_player.isBackground && html5_video_player.backgroundIsInited ) return; html5_video_player.canPlayOnMobile = html5_video_player.isSelf && jQuery( this ).children().length === 0; if( !html5_video_player.isSelf ) { $html5_video_player.hide(); } var overlay = jQuery( "
" ).css( { position: "absolute", top: 0, left: 0, width: "100%", height: "100%" } ).addClass( "html5_video_player_overlay" ); if( html5_video_player.isSelf ) { overlay.on( "click", function() { $html5_video_player.togglePlay(); } ) } var playerID = "html5_video_player_" + html5_video_player.id; var wrapper = jQuery( "
" ).addClass( "html5_video_player_wrapper" ).attr( "id", "html5_video_player_wrapper_" + playerID ); wrapper.css( { position: "absolute", zIndex: 0, minWidth: "100%", minHeight: "100%", left: 0, top: 0, overflow: "hidden", opacity: 1 } ); html5_video_player.playerBox = jQuery( "