-angular.module('directives.youtubeEmbed', ['app.enums']).directive "youtubeEmbed", ["$log", "$timeout", "$rootScope", "enums", ($log, $timeout, $rootScope, enums) ->
+angular.module('directives.youtubeEmbed', ['app.enums'])
+.directive "youtubeEmbed", ["$log", "$timeout", "$rootScope", "enums", ($log, $timeout, $rootScope, enums) ->
   priority: 0
   template: ""
   replace: false


          if scope.hasStarted && newState.data == YT.PlayerState.ENDED
            $rootScope.$broadcast enums.EventType.VideoEnd, scope.videoData


    post: postLink = (scope, iElement, iAttrs, controller) ->

      ytLoaded = window.YT != undefined && window.YT.Player != undefined
      if !ytLoaded
        _onYouTubeIframeAPIReady = window.onYouTubeIframeAPIReady

        scope.onAPIReady()
]

angular.module('directives.videoJsEmbed', ['app.enums'])
.directive "videoJsEmbed", ["$log", "$timeout", "$rootScope", "enums", ($log, $timeout, $rootScope, enums) ->
  priority: 0
  template: ""
  replace: false
  transclude: false
  restrict: "A"
  scope: {videoData: '=videoJsEmbed', videoId: '=VideoJsId'}
  compile: ->
    post: (scope, iElement) ->
      if scope && scope.videoData
        if scope.videoData.mp4
          mp4src = scope.videoData.mp4.toString()
          if Modernizr.video.h264 and scope.videoData.mp4_low
            mp4src = scope.videoData.mp4_low
        player = videojs iElement.attr("id"), {}, ->
          player.poster scope.videoData.poster
          player.src(
            {type: "video/mp4", src: mp4src},
            {type: "video/webm", src: scope.videoData.webm}
