|
|
|
@ -9,6 +9,8 @@ define([
|
|
|
|
|
, "jquery"
|
|
|
|
|
, "backbone"
|
|
|
|
|
|
|
|
|
|
, "modules/webaudio"
|
|
|
|
|
|
|
|
|
|
, "text!../../templates/player/layout.html"
|
|
|
|
|
, "text!../../templates/player/player-status.html"
|
|
|
|
|
]
|
|
|
|
@ -17,6 +19,8 @@ _
|
|
|
|
|
, $
|
|
|
|
|
, Backbone
|
|
|
|
|
|
|
|
|
|
, WebAudio
|
|
|
|
|
|
|
|
|
|
, tmplPlayerLayout
|
|
|
|
|
, tmplPlayerStatus
|
|
|
|
|
) {
|
|
|
|
@ -42,12 +46,26 @@ _
|
|
|
|
|
|
|
|
|
|
, _stateAudio: null
|
|
|
|
|
|
|
|
|
|
, events: {
|
|
|
|
|
//"click #add-friend": "showPrompt",
|
|
|
|
|
"click div:first-child > a.buttonPrev": "__buttonPrevious"
|
|
|
|
|
, "click div:first-child > a.buttonNext": "__buttonNext"
|
|
|
|
|
, "click div:first-child > a.buttonPlay": "__buttonPlayPause"
|
|
|
|
|
// Volume Down
|
|
|
|
|
, "click div:first-child > .playerVolumeWrapper > a:first-child": "__buttonVolumeDown"
|
|
|
|
|
// Volume Up
|
|
|
|
|
, "click div:first-child > .playerVolumeWrapper > a:last-child": "__buttonVolumeUp"
|
|
|
|
|
// Volume click
|
|
|
|
|
, "click div:first-child > .playerVolumeWrapper > input": "__buttonVolumeClick"
|
|
|
|
|
// Seek input
|
|
|
|
|
, "click div:last-child > .playerProgressWrapper > progress": "__buttonSeek"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, initialize: function (options) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
_.bindAll(this
|
|
|
|
|
, "setPlayIndex"
|
|
|
|
|
, "setRandomState"
|
|
|
|
|
, "setRepeatState"
|
|
|
|
|
, "__buttonPlayPause"
|
|
|
|
@ -56,6 +74,7 @@ _
|
|
|
|
|
, "__buttonVolumeUp"
|
|
|
|
|
, "__buttonVolumeDown"
|
|
|
|
|
, "__buttonVolumeClick"
|
|
|
|
|
, "__buttonSeek"
|
|
|
|
|
, "_createWebAudio"
|
|
|
|
|
, "__waStateChanged"
|
|
|
|
|
, "_playerEnded"
|
|
|
|
@ -66,6 +85,8 @@ _
|
|
|
|
|
, "_playerStop"
|
|
|
|
|
, "_playerStart"
|
|
|
|
|
, "_setVolume"
|
|
|
|
|
, "_getItemData"
|
|
|
|
|
, "_getItemMediaUrl"
|
|
|
|
|
, "_setViewport"
|
|
|
|
|
, "_updateViewportProgress"
|
|
|
|
|
);
|
|
|
|
@ -84,6 +105,9 @@ _
|
|
|
|
|
return that;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* PUBLIC
|
|
|
|
|
**/
|
|
|
|
|
, setPlayIndex: function (index) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
@ -102,6 +126,9 @@ _
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* EVENTS
|
|
|
|
|
**/
|
|
|
|
|
, __buttonPlayPause: function (event) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
@ -138,6 +165,16 @@ _
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, __buttonSeek: function (event) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* PRIVATE
|
|
|
|
|
**/
|
|
|
|
|
// Audio Player
|
|
|
|
|
, _createWebAudio: function () {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
@ -150,6 +187,7 @@ _
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Player Controls
|
|
|
|
|
, _playerEnded: function () {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
@ -198,6 +236,19 @@ _
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Viewport methods
|
|
|
|
|
, _getItemData: function (item) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, _getItemMediaUrl: function (item) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, _setViewport: function (item) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
|