From 4483bda9aabe87354264061aac7d7fda6b6aa142 Mon Sep 17 00:00:00 2001 From: David Karchmer Date: Fri, 11 Sep 2015 19:34:12 -0700 Subject: [PATCH] Need to include dist output As that is what bower install needs --- .gitignore | 1 - bower.json | 2 +- dist/jwplayer.js | 114 +++++++++++++++++++++++++++++++++++++++++++ dist/jwplayer.min.js | 4 ++ package.json | 2 +- 5 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 dist/jwplayer.js create mode 100644 dist/jwplayer.min.js diff --git a/.gitignore b/.gitignore index 1f309e5..9df3010 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ bower_components/ .sass-cache/ .idea/ .tmp/ -dist/ diff --git a/bower.json b/bower.json index c50626b..a74d8ba 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ng-jwplayer", - "version": "0.0.3", + "version": "0.0.4", "main": "dist/jwplayer.js", "ignore": [ "src", diff --git a/dist/jwplayer.js b/dist/jwplayer.js new file mode 100644 index 0000000..e09a540 --- /dev/null +++ b/dist/jwplayer.js @@ -0,0 +1,114 @@ +/** + * Created by David Karchmer on 9/11/15. + */ +(function() { + 'use strict'; + + angular + .module('ng-jwplayer', [ + ]); +})(); +/* global jwplayer */ +/** + * Created by David Karchmer on 9/11/15. + */ + +(function () { + 'use strict'; + + angular + .module('ng-jwplayer') + .service('jwplayerService', JWPlayerService); + + /* @ngInject */ + function JWPlayerService($log) { + + this.existJWPlayer = function() { + return (angular.isDefined(this.myPlayer) && this.myPlayer !== null); + }; + + this.initJWPlayer = function(id) { + + if (this.existJWPlayer()) { + + $log.debug('Instance of JWPlayer exists. Removing first'); + this.myPlayer.remove(); + this.myPlayer = null; + } + + this.myPlayer = jwplayer(id); + + return this.myPlayer; + }; + + this.cleanUp = function() { + if (this.existJWPlayer()) { + + $log.debug('Removing existing JWPlayer'); + this.myPlayer.remove(); + this.myPlayer = null; + } + }; + } + JWPlayerService.$inject = ["$log"]; + +})(); +/** + * Created by David Karchmer on 9/11/15. + */ +(function() { + 'use strict'; + + angular + .module('ng-jwplayer') + .directive('jwplayer', JWPlayer); + + /* @ngInject */ + function JWPlayer($compile, $log, jwplayerService) { + + var player; + + var _renderJWPlayerElement = function(scope, element) { + var id = scope.playerId, + getTemplate = function (playerId) { + return '
'; + }; + + element.html(getTemplate(id)); + $compile(element.contents())(scope); + player = jwplayerService.initJWPlayer(id); + player.setup(scope.playerOptions); + }; + + return { + restrict: 'EC', + scope: { + playerId: '@', + playerOptions: '=' + }, + link: function (scope, element, attrs) { + + scope.$on('$destroy', function () { + $log.debug('jwplayer onDestroy'); + jwplayerService.cleanUp(); + }); + + scope.$watch(function () { + return attrs.ngSrc; + }, function (value) { + $log.debug('ng-src has changed: ' + value); + if (angular.isDefined(scope.playerOptions)) { + scope.playerOptions.file = value; + _renderJWPlayerElement(scope, element); + } + }); + + if (angular.isDefined(attrs.ngSrc) && angular.isDefined(scope.playerOptions)) { + scope.playerOptions.file = attrs.ngSrc; + _renderJWPlayerElement(scope, element); + } + } + }; + } + JWPlayer.$inject = ["$compile", "$log", "jwplayerService"]; +})(); diff --git a/dist/jwplayer.min.js b/dist/jwplayer.min.js new file mode 100644 index 0000000..b307577 --- /dev/null +++ b/dist/jwplayer.min.js @@ -0,0 +1,4 @@ +/** + * Created by David Karchmer on 9/11/15. + */ +!function(){"use strict";angular.module("ng-jwplayer",[])}(),function(){"use strict";function e(e){this.existJWPlayer=function(){return angular.isDefined(this.myPlayer)&&null!==this.myPlayer},this.initJWPlayer=function(n){return this.existJWPlayer()&&(e.debug("Instance of JWPlayer exists. Removing first"),this.myPlayer.remove(),this.myPlayer=null),this.myPlayer=jwplayer(n),this.myPlayer},this.cleanUp=function(){this.existJWPlayer()&&(e.debug("Removing existing JWPlayer"),this.myPlayer.remove(),this.myPlayer=null)}}angular.module("ng-jwplayer").service("jwplayerService",e),e.$inject=["$log"]}(),function(){"use strict";function e(e,n,i){var r,t=function(n,t){var l=n.playerId,a=function(e){return'
'};t.html(a(l)),e(t.contents())(n),r=i.initJWPlayer(l),r.setup(n.playerOptions)};return{restrict:"EC",scope:{playerId:"@",playerOptions:"="},link:function(e,r,l){e.$on("$destroy",function(){n.debug("jwplayer onDestroy"),i.cleanUp()}),e.$watch(function(){return l.ngSrc},function(i){n.debug("ng-src has changed: "+i),angular.isDefined(e.playerOptions)&&(e.playerOptions.file=i,t(e,r))}),angular.isDefined(l.ngSrc)&&angular.isDefined(e.playerOptions)&&(e.playerOptions.file=l.ngSrc,t(e,r))}}}angular.module("ng-jwplayer").directive("jwplayer",e),e.$inject=["$compile","$log","jwplayerService"]}(); \ No newline at end of file diff --git a/package.json b/package.json index b112be6..5e432c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng-jwplayer", - "version": "0.0.3", + "version": "0.0.4", "author": "David Karchmer", "license": "MIT", "description": "Angular directive for JWPlayer",