Files
easystream-main/f_scripts/shared/videojs/videojs-dailymotion.min.js
SamiAhmed7777 0b7e2d0a5b feat: Add comprehensive documentation suite and reorganize project structure
- Created complete documentation in docs/ directory
- Added PROJECT_OVERVIEW.md with feature highlights and getting started guide
- Added ARCHITECTURE.md with system design and technical details
- Added SECURITY.md with comprehensive security implementation guide
- Added DEVELOPMENT.md with development workflows and best practices
- Added DEPLOYMENT.md with production deployment instructions
- Added API.md with complete REST API documentation
- Added CONTRIBUTING.md with contribution guidelines
- Added CHANGELOG.md with version history and migration notes
- Reorganized all documentation files into docs/ directory for better organization
- Updated README.md with proper documentation links and quick navigation
- Enhanced project structure with professional documentation standards
2025-10-21 00:39:45 -07:00

1 line
9.1 KiB
JavaScript

!function(){function addEventListener(element,event,cb){element.addEventListener?element.addEventListener(event,cb,!0):element.attachEvent(event,cb)}videojs.Dailymotion=videojs.MediaTechController.extend({init:function(player,options,ready){if(videojs.MediaTechController.call(this,player,options,ready),this.player_=player,this.playerEl_=this.player_.el(),"undefined"!=typeof this.player_.options().dmControls){var dmC=this.player_.options().dmControls=parseInt(this.player_.options().dmControls)&&this.player_.controls();dmC&&this.player_.controls()&&this.player_.controls(!dmC)}if("undefined"!=typeof options.source)for(var key in options.source)options.source.hasOwnProperty(key)&&(this.player_.options()[key]=options.source[key]);var self=this;if(this.bindedWaiting=function(){self.onWaiting()},this.player_.on("waiting",this.bindedWaiting),player.ready(function(){self.playOnReady&&!self.player_.options().dmControls&&("undefined"!=typeof self.player_.loadingSpinner&&self.player_.loadingSpinner.show(),"undefined"!=typeof self.player_.bigPlayButton&&self.player_.bigPlayButton.hide()),player.trigger("loadstart")}),this.videoId=this.parseSrc(this.player_.options().src),"undefined"!=typeof this.videoId&&(this.player_.options().dmControls||"undefined"==typeof this.player_.poster()&&(this.player_.poster(),setTimeout(function(){var posterEl=self.playerEl_.querySelectorAll(".vjs-poster")[0];posterEl.style.backgroundImage="url(https://api.dailymotion.com/video/"+self.videoId+"?fields=url&ads=false)",posterEl.style.display="",posterEl.style.backgroundSize="cover"},100))),this.id_=this.player_.id()+"_dailymotion_api",this.el_=videojs.Component.prototype.createEl("iframe",{id:this.id_,className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0,webkitAllowFullScreen:"",mozallowfullscreen:"",allowFullScreen:""}),this.playerEl_.insertBefore(this.el_,this.playerEl_.firstChild),/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var ieVersion=Number(RegExp.$1);this.addIframeBlocker(ieVersion)}else/(iPad|iPhone|iPod|Android)/g.test(navigator.userAgent)||(this.el_.className+=" onDesktop",this.addIframeBlocker());if(this.params={id:this.id_,autoplay:this.player_.options().autoplay?1:0,chromeless:this.player_.options().dmControls?0:1,html:1,info:1,logo:1,controls:"html",wmode:"opaque",format:"json",url:this.player_.options().src},"undefined"==typeof this.params.list&&delete this.params.list,this.player_.options().autoplay&&(this.player_.bigPlayButton.hide(),this.playOnReady=!0),"file:"!==window.location.protocol&&(this.params.origin=window.location.protocol+"//"+window.location.hostname),this.el_.src="http://www.dailymotion.com/services/oembed?"+videojs.Dailymotion.makeQueryString(this.params),videojs.Dailymotion.apiReady)this.loadApi();else if(videojs.Dailymotion.loadingQueue.push(this),!videojs.Dailymotion.apiLoading){var tag=document.createElement("script");tag.onerror=function(e){self.onError(e)},tag.src="http://api.dmcdn.net/all.js";var firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag),videojs.Dailymotion.apiLoading=!0}}}),videojs.Dailymotion.prototype.params=[],videojs.Dailymotion.prototype.onWaiting=function(){"undefined"!=typeof this.player_.bigPlayButton&&this.player_.bigPlayButton.hide()},videojs.Dailymotion.prototype.addIframeBlocker=function(ieVersion){if(this.player_.options().dmControls)return!1;this.iframeblocker=videojs.Component.prototype.createEl("div"),this.iframeblocker.className="iframeblocker",this.iframeblocker.style.position="absolute",this.iframeblocker.style.left=0,this.iframeblocker.style.right=0,this.iframeblocker.style.top=0,this.iframeblocker.style.bottom=0,ieVersion&&9>ieVersion?this.iframeblocker.style.opacity=.01:this.iframeblocker.style.background="rgba(255, 255, 255, 0.01)";var self=this;addEventListener(this.iframeblocker,"mousemove",function(e){self.player_.userActive()||self.player_.userActive(!0),e.stopPropagation(),e.preventDefault()}),addEventListener(this.iframeblocker,"click",function(){self.paused()?self.play():self.pause()}),this.playerEl_.insertBefore(this.iframeblocker,this.el_.nextSibling)},videojs.Dailymotion.prototype.dispose=function(){if(this.dmPlayer){this.pause();for(var i=0;i<this.dmPlayer.listeners.length;i++){var listener=this.dmPlayer.listeners[i];this.dmPlayer.removeEventListener(listener.event,listener.func)}this.dmPlayer=null}this.playerEl_.querySelectorAll(".vjs-poster")[0].style.backgroundImage="none";var el=document.getElementById(this.id_);el.parentNode&&el.parentNode.removeChild(el),"undefined"!=typeof this.player_.loadingSpinner&&this.player_.loadingSpinner.hide(),"undefined"!=typeof this.player_.bigPlayButton&&this.player_.bigPlayButton.hide(),videojs.MediaTechController.prototype.dispose.call(this)},videojs.Dailymotion.prototype.src=function(src){return"undefined"!=typeof src&&this.dmPlayer.load(this.parseSrc(src)),this.srcVal},videojs.Dailymotion.prototype.currentSrc=function(){return this.srcVal},videojs.Dailymotion.prototype.play=function(){this.isReady_?this.dmPlayer.play():(this.playOnReady=!0,this.player_.options.dmControls||this.player_.bigPlayButton.show())},videojs.Dailymotion.prototype.ended=function(){if(this.isReady_){var stateId=this.dmPlayer.getPlayerState();return 0===stateId}return!1},videojs.Dailymotion.prototype.pause=function(){this.dmPlayer.pause(!this.dmPlayer.paused)},videojs.Dailymotion.prototype.paused=function(){return this.dmPlayer.paused},videojs.Dailymotion.prototype.currentTime=function(){return this.dmPlayer&&this.dmPlayer.currentTime?this.dmPlayer.currentTime:0},videojs.Dailymotion.prototype.setCurrentTime=function(seconds){this.dmPlayer.seek(seconds,!0),this.player_.trigger("timeupdate")},videojs.Dailymotion.prototype.duration=function(){return this.dmPlayer&&this.dmPlayer.duration?this.dmPlayer.duration:0},videojs.Dailymotion.prototype.buffered=function(){return[]},videojs.Dailymotion.prototype.volume=function(){return isNaN(this.volumeVal)&&(this.volumeVal=this.dmPlayer.volume),this.volumeVal},videojs.Dailymotion.prototype.setVolume=function(percentAsDecimal){percentAsDecimal&&percentAsDecimal!==this.volumeVal&&(this.dmPlayer.setVolume(percentAsDecimal),this.volumeVal=percentAsDecimal,this.player_.trigger("volumechange"))},videojs.Dailymotion.prototype.muted=function(){return this.dmPlayer.muted},videojs.Dailymotion.prototype.setMuted=function(muted){this.dmPlayer.setMuted(muted);var self=this;setTimeout(function(){self.player_.trigger("volumechange")},50)},videojs.Dailymotion.prototype.onReady=function(){this.isReady_=!0,this.player_.trigger("techready"),this.triggerReady(),this.player_.trigger("durationchange"),this.playOnReady&&this.dmPlayer.play()},videojs.Dailymotion.isSupported=function(){return!0},videojs.Dailymotion.prototype.supportsFullScreen=function(){return!1},videojs.Dailymotion.canPlaySource=function(srcObj){return"video/dailymotion"===srcObj.type},videojs.Dailymotion.loadingQueue=[],videojs.Dailymotion.prototype.load=function(){},videojs.Dailymotion.prototype.loadApi=function(){this.dmPlayer=new DM.player(this.id_,{video:this.videoId,width:this.options.width,height:this.options.height,params:this.params}),this.setupTriggers(),this.dmPlayer.vjsTech=this},videojs.Dailymotion.prototype.onStateChange=function(event){var state=event.type;if(state!==this.lastState){switch(state){case-1:this.player_.trigger("durationchange");break;case"apiready":this.onReady();break;case"ended":this.player_.options().dmControls||this.player_.bigPlayButton.show();break;case"play":this.player_.trigger("play");break;case"playing":break;case"pause":break;case"durationchange":break;case"timeupdate":this.player_.loadingSpinner.hide();break;case"progress":}this.lastState=state}},videojs.Dailymotion.prototype.onError=function(error){this.player_.error(error),(100===error||101===error||150===error)&&(this.player_.bigPlayButton.hide(),this.player_.loadingSpinner.hide(),this.player_.posterImage.hide())},videojs.Dailymotion.makeQueryString=function(args){var array=[];for(var key in args)args.hasOwnProperty(key)&&array.push(encodeURIComponent(key)+"="+encodeURIComponent(args[key]));return array.join("&")},videojs.Dailymotion.prototype.parseSrc=function(src){if(this.srcVal=src,src){var regExp=/^.+dailymotion.com\/((video|hub)\/([^_]+))?[^#]*(#video=([^_&]+))?/,match=src.match(regExp);return match?match[5]||match[3]:null}},videojs.Dailymotion.parsePlaylist=function(src){var regExp=/[?&]list=([^#\&\?]+)/,match=src.match(regExp);return null!==match&&match.length>1?match[1]:void 0},videojs.Dailymotion.prototype.setupTriggers=function(){this.dmPlayer.listeners=[];for(var i=videojs.Dailymotion.Events.length-1;i>=0;i--){var listener=videojs.bind(this,this.eventHandler);this.dmPlayer.listeners.push({event:videojs.Dailymotion.Events[i],func:listener}),this.dmPlayer.addEventListener(videojs.Dailymotion.Events[i],listener)}},videojs.Dailymotion.prototype.eventHandler=function(e){this.onStateChange(e),this.trigger(e)},videojs.Dailymotion.Events="apiready,play,playing,pause,ended,canplay,canplaythrough,timeupdate,progress,seeking,seeked,volumechange,durationchange,fullscreenchange,error".split(","),window.dmAsyncInit=function(){for(var dm;dm=videojs.Dailymotion.loadingQueue.shift();)dm.loadApi();videojs.Dailymotion.loadingQueue=[],videojs.Dailymotion.apiReady=!0}}();