Skip to content

Commit

Permalink
Need to include dist output
Browse files Browse the repository at this point in the history
As that is what bower install needs
  • Loading branch information
David Karchmer committed Sep 12, 2015
1 parent 7239ac2 commit 4483bda
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ bower_components/
.sass-cache/
.idea/
.tmp/
dist/
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-jwplayer",
"version": "0.0.3",
"version": "0.0.4",
"main": "dist/jwplayer.js",
"ignore": [
"src",
Expand Down
114 changes: 114 additions & 0 deletions dist/jwplayer.js
Original file line number Diff line number Diff line change
@@ -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 '<div id="' + playerId + '"></div>';
};

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"];
})();
4 changes: 4 additions & 0 deletions dist/jwplayer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 4483bda

Please sign in to comment.