Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. angular.module('whiteboardPlayer', []).directive('whiteboardplayer', function () {
  2.     return {
  3.         restrict: 'E',
  4.         scope: { time: '=', state: '=', events: '@', recordedRanges: '@', audioUrl: '@', ratio: '@' },
  5.         templateUrl: 'src/components/whiteboard/whiteboard-player.html',
  6.         link: function (scope, element, attributes) {
  7.             var whiteboard;
  8.    
  9.             whiteboard = new WhiteboardPlayerUi($(".whiteboard-player:first"));
  10.            
  11.             whiteboard.setPlaybackStateChangeCallback(function (whiteboard, state) {
  12.                 scope.time = whiteboard.getPlaybackTime() / 1000;
  13.                 scope.state = state;
  14.             });
  15.                
  16.             scope.$watch(attributes.events, function (value) {
  17.                 value = scope.$eval(value);
  18.                
  19.                 whiteboard.setEvents(scope.events);
  20.             });
  21.            
  22.             scope.$watch(attributes.recordedRanges, function (value) {
  23.                 value = scope.$eval(value);
  24.                
  25.                 whiteboard.setRecordedRanges(value);
  26.             });
  27.            
  28.             scope.$watch(attributes.audioUrl, function (value) {
  29.                 value = scope.$eval(value);
  30.                
  31.                 whiteboard.setAudioURL(value);
  32.             });
  33.            
  34.             scope.$watch(attributes.ratio, function (value) {
  35.                 value = scope.$eval(value);
  36.                
  37.                 whiteboard.setAspectRatio(value);
  38.             });
  39.         }
  40.     };
  41. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement