mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 17:48:51 +00:00
80 lines
3.0 KiB
JavaScript
Executable File
80 lines
3.0 KiB
JavaScript
Executable File
// Generated by CoffeeScript 1.4.0
|
|
(function() {
|
|
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
|
__hasProp = {}.hasOwnProperty,
|
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
|
|
|
define(['app', 'marionette', 'vent', 'utils'], function(App, Marionette, vent, utils) {
|
|
var AudioController;
|
|
AudioController = (function(_super) {
|
|
|
|
__extends(AudioController, _super);
|
|
|
|
function AudioController() {
|
|
this.mixInit = __bind(this.mixInit, this);
|
|
return AudioController.__super__.constructor.apply(this, arguments);
|
|
}
|
|
|
|
AudioController.prototype.initialize = function(options) {
|
|
console.log("AudioController: initialize");
|
|
this.listenTo(vent, 'mix:init', this.mixInit);
|
|
this.listenTo(vent, 'mix:pause', this.mixPause);
|
|
this.listenTo(vent, 'mix:play', this.mixPlay);
|
|
this.listenTo(vent, 'live:play', this.livePlay);
|
|
return this.listenTo(vent, 'live:pause', this.livePause);
|
|
};
|
|
|
|
AudioController.prototype.mixInit = function(model) {
|
|
var id,
|
|
_this = this;
|
|
console.log("AudioController: mixInit");
|
|
id = model.get('id');
|
|
com.podnoms.player.stopPlaying();
|
|
return $.getJSON("/ajax/mix_stream_url/" + id + "/", function(data) {
|
|
com.podnoms.settings.setupPlayerWrapper(id, data.stream_url);
|
|
com.podnoms.player.startPlaying({
|
|
success: function() {
|
|
vent.trigger("mix:play", model);
|
|
utils.checkPlayCount();
|
|
},
|
|
error: function() {
|
|
utils.showWarning("Ooops", "Error playing mix. If you have a flash blocker, please disable it for this site. Otherwise, do please try again.");
|
|
}
|
|
});
|
|
com.podnoms.storage.setItem("now_playing", id);
|
|
});
|
|
};
|
|
|
|
AudioController.prototype.mixPlay = function(model) {
|
|
console.log("AudioController: mixPlay");
|
|
return com.podnoms.player.resume();
|
|
};
|
|
|
|
AudioController.prototype.mixPause = function(model) {
|
|
console.log("AudioController: mixPause");
|
|
return com.podnoms.player.pause();
|
|
};
|
|
|
|
AudioController.prototype.livePlay = function() {
|
|
console.log("AudioController: livePlay");
|
|
return com.podnoms.player.playLive({
|
|
success: function() {
|
|
console.log("Live stream started");
|
|
return vent.trigger('live:started');
|
|
}
|
|
});
|
|
};
|
|
|
|
AudioController.prototype.livePause = function() {
|
|
console.log("AudioController: livePause");
|
|
return com.podnoms.player.stopLive();
|
|
};
|
|
|
|
return AudioController;
|
|
|
|
})(Marionette.Controller);
|
|
return AudioController;
|
|
});
|
|
|
|
}).call(this);
|