require.config({
  paths: {
    jwplayer: "../../../attachment/xwiki/Macros/JWPlayer/jwplayer"
  },
  shim: {
    jwplayer: {
      exports: 'jwplayer'
    }
  }
});
require(['jQueryNoConflict', 'jwplayer'], function($, jwplayer) {
  jwplayer.key="QowE9R/MhMc1H2U6HxMlLTxvbtbk+uhwkexhBQ==";
  $('.jwplayer').each(function(index) {
    var options = {
      file: $(this).attr('data-source'),
      autostart: $(this).hasClass('autostart'),
      repeat: $(this).hasClass('repeat')
    };
    var width = $(this).attr('data-width');
    width && (options.width = width);
    var height = $(this).attr('data-height');
    height && (options.height = height);
    this.id = this.id || ('jwplayer' + index);
    jwplayer(this.id).setup(options);
  });
});
