-
Notifications
You must be signed in to change notification settings - Fork 6
/
jwplayer.min.js
5 lines (5 loc) · 1.54 KB
/
jwplayer.min.js
1
2
3
4
5
/* global jwplayer */
/**
* Created by David Karchmer on 9/11/15.
*/
!function(){"use strict";angular.module("ng-jwplayer",[]).constant("jwplayer",jwplayer)}(),function(){"use strict";function e(e){this.myPlayer={},this.existJWPlayer=function(e){return angular.isDefined(this.myPlayer)&&angular.isDefined(this.myPlayer[e])&&null!==this.myPlayer[e]},this.initJWPlayer=function(r){return this.cleanUp(r),this.myPlayer[r]=e(r),this.myPlayer[r]},this.cleanUp=function(e){this.existJWPlayer(e)&&(this.myPlayer[e].remove(),this.myPlayer[e]=null)}}e.$inject=["jwplayer"],angular.module("ng-jwplayer").service("jwplayerService",e)}(),function(){"use strict";function e(e,r,n,a){var i,t=function(r,t){var l=r.playerId||"myPlayer1",y=function(e){return'<div id="'+e+'"></div>'};t.html(y(l)),e(t.contents())(r),i=a.initJWPlayer(l),i.setup(r.playerOptions),i.on("ready",function(){n.$broadcast("ng-jwplayer-ready",{playerId:l})}),i.on("setupError",function(){n.$broadcast("ng-jwplayer-setup-error",{playerId:l})})};return{restrict:"EC",scope:{playerId:"@",playerOptions:"="},link:function(e,n,i){var l=e.playerId||"myPlayer1";e.$on("$destroy",function(){r.debug("jwplayer onDestroy: "+l),a.cleanUp(l)}),e.$watch(function(){return i.ngSrc},function(a){r.debug("ng-src("+l+") has changed: "+a),angular.isDefined(e.playerOptions)&&(e.playerOptions.file=a,t(e,n))}),angular.isDefined(i.ngSrc)&&angular.isDefined(e.playerOptions)&&(e.playerOptions.file=i.ngSrc,t(e,n))}}}e.$inject=["$compile","$log","$rootScope","jwplayerService"],angular.module("ng-jwplayer").directive("jwplayer",e)}();