       tracks = _.map data.media_tracks, (track) ->
           languageName = mejs.language.codes[track.locale] || track.locale
           "<track kind='#{track.kind}' label='#{languageName}' src='#{track.url}' srclang='#{track.locale}' />"
-      dfd.resolve {sources, tracks, can_add_captions: data.can_add_captions}
+      types = _.map data.media_sources, (source) -> source.content_type
+      dfd.resolve {sources, tracks, types, can_add_captions: data.can_add_captions}
     dfd
 
   # After clicking an image to play the video, load the sources and tracks

  $.extend mejs.MepDefaults,
    # prefer flash player, as it works more consistently
    # for now, but allow fallback to html5 (like on mobile)
    mode: 'auto_plugin'
    success: (mediaElement, domObject) ->
      if(mediaElement.pluginType == 'flash')
        mediaElement.play()

  isMobileDevice = () ->
    agent = navigator.userAgent.toLowerCase()
    agent.match(/ip(hone|od|ad)/i) or agent.match(/android/i)

  browserSupportsVideoInAudioTag = () -> isMobileDevice()

  # track events in google analytics
  mejs.MepDefaults.features.push('googleanalytics')

  'vendor/mediaelement-and-player'
  'jquery'
], (I18n, _, pubsub, mejs, $) ->

  isIE9 = () -> $("body").hasClass("ie9")
  isMobileDevice = () ->
    agent = navigator.userAgent.toLowerCase()
    agent.match(/ip(hone|od|ad)/i) or agent.match(/android/i)

  browserSupportsVideoInAudioTag = () -> isMobileDevice()

  VIDEO_WIDTH = 550
  VIDEO_HEIGHT = 448
