+ var player = null;
+
+ var setMedia = function(elem, time=0) {
+ console.log('setMedia', elem, time);
+ var media = {}
+
+ media['mp3'] = elem.attr('data-mp3');
+ media['oga'] = elem.attr('data-ogg');
+ media['id'] = elem.attr('data-media-id');
+
+ $(".c-player__head", $root).html(
+ $(".attribution", elem).html())
+ ;
+ $(".c-player__info", $root).html(
+ $(".title", elem).html()
+ );
+ $(".c-media__caption .content", $root).html($(".project-description", elem).html());
+ $(".c-media__caption .license", $root).html($(".license", elem).html());
+ $(".c-media__caption .project-logo", $root).html($(".project-icon", elem).html());
+
+ player.jPlayer("setMedia", media);
+ player.jPlayer("option", "playbackRate", speed);
+ player.jPlayer("pause", time);
+
+ $currentMedia = elem;
+ $(".play-prev", $root).prop("disabled", !elem.prev().length);
+ $(".play-next", $root).prop("disabled", !elem.next().length);
+
+ let du = elem.data('duration');
+ currentDuration = du;
+ elem.nextAll().each(function() {
+ du += $(this).data('duration');
+ });
+ totalDurationLeft = du;
+
+ return player;
+ };