diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-01 06:33:26 -0500 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-01 06:33:26 -0500 |
| commit | 2fe632d47c2c12aea423fdb837057d86d136e7c1 (patch) | |
| tree | 5169c6a293e617a46cb4cd9d4ce872eea9c415a3 /www/lib/videogular-overlay-play/vg-overlay-play.js | |
| parent | 5f452cb3add568b0b2dcc795e7885b6275f918e1 (diff) | |
inital commits - getting video branch to work #60 - implemented in quick scrub - works fine
Diffstat (limited to 'www/lib/videogular-overlay-play/vg-overlay-play.js')
| -rw-r--r-- | www/lib/videogular-overlay-play/vg-overlay-play.js | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/www/lib/videogular-overlay-play/vg-overlay-play.js b/www/lib/videogular-overlay-play/vg-overlay-play.js new file mode 100644 index 00000000..a5142f07 --- /dev/null +++ b/www/lib/videogular-overlay-play/vg-overlay-play.js @@ -0,0 +1,77 @@ +/** + * @license videogular v1.3.2 http://videogular.com + * Two Fucking Developers http://twofuckingdevelopers.com + * License: MIT + */ +/** + * @ngdoc directive + * @name com.2fdevs.videogular.plugins.overlayplay.directive:vgOverlayPlay + * @restrict E + * @description + * Shows a big play button centered when player is paused or stopped. + * + * <pre> + * <videogular vg-theme="config.theme.url" vg-autoplay="config.autoPlay"> + * <vg-media vg-src="sources"></vg-media> + * + * <vg-overlay-play></vg-overlay-play> + * </videogular> + * </pre> + * + */ +"use strict"; +angular.module("com.2fdevs.videogular.plugins.overlayplay", []) + .run( + ["$templateCache", function ($templateCache) { + $templateCache.put("vg-templates/vg-overlay-play", + '<div class="overlayPlayContainer" ng-click="onClickOverlayPlay()">\ + <div class="iconButton" ng-class="overlayPlayIcon"></div>\ + </div>'); + }] +) + .directive( + "vgOverlayPlay", + ["VG_STATES", function (VG_STATES) { + return { + restrict: "E", + require: "^videogular", + scope: {}, + templateUrl: function (elem, attrs) { + return attrs.vgTemplate || 'vg-templates/vg-overlay-play'; + }, + link: function (scope, elem, attr, API) { + scope.onChangeState = function onChangeState(newState) { + switch (newState) { + case VG_STATES.PLAY: + scope.overlayPlayIcon = {}; + break; + + case VG_STATES.PAUSE: + scope.overlayPlayIcon = {play: true}; + break; + + case VG_STATES.STOP: + scope.overlayPlayIcon = {play: true}; + break; + } + }; + + scope.onClickOverlayPlay = function onClickOverlayPlay(event) { + API.playPause(); + }; + + scope.overlayPlayIcon = {play: true}; + + scope.$watch( + function () { + return API.currentState; + }, + function (newVal, oldVal) { + scope.onChangeState(newVal); + } + ); + } + } + } + ]); + |
