|
|
@ -9,6 +9,8 @@ define([
|
|
|
|
, "jquery"
|
|
|
|
, "jquery"
|
|
|
|
, "backbone"
|
|
|
|
, "backbone"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, "modules/webaudio"
|
|
|
|
|
|
|
|
|
|
|
|
, "text!../../templates/player/layout.html"
|
|
|
|
, "text!../../templates/player/layout.html"
|
|
|
|
, "text!../../templates/player/player-status.html"
|
|
|
|
, "text!../../templates/player/player-status.html"
|
|
|
|
]
|
|
|
|
]
|
|
|
@ -17,6 +19,8 @@ _
|
|
|
|
, $
|
|
|
|
, $
|
|
|
|
, Backbone
|
|
|
|
, Backbone
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, WebAudio
|
|
|
|
|
|
|
|
|
|
|
|
, tmplPlayerLayout
|
|
|
|
, tmplPlayerLayout
|
|
|
|
, tmplPlayerStatus
|
|
|
|
, tmplPlayerStatus
|
|
|
|
) {
|
|
|
|
) {
|
|
|
@ -42,12 +46,26 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
, _stateAudio: null
|
|
|
|
, _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) {
|
|
|
|
, initialize: function (options) {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
_.bindAll(this
|
|
|
|
_.bindAll(this
|
|
|
|
, "setPlayIndex"
|
|
|
|
|
|
|
|
, "setRandomState"
|
|
|
|
, "setRandomState"
|
|
|
|
, "setRepeatState"
|
|
|
|
, "setRepeatState"
|
|
|
|
, "__buttonPlayPause"
|
|
|
|
, "__buttonPlayPause"
|
|
|
@ -56,6 +74,7 @@ _
|
|
|
|
, "__buttonVolumeUp"
|
|
|
|
, "__buttonVolumeUp"
|
|
|
|
, "__buttonVolumeDown"
|
|
|
|
, "__buttonVolumeDown"
|
|
|
|
, "__buttonVolumeClick"
|
|
|
|
, "__buttonVolumeClick"
|
|
|
|
|
|
|
|
, "__buttonSeek"
|
|
|
|
, "_createWebAudio"
|
|
|
|
, "_createWebAudio"
|
|
|
|
, "__waStateChanged"
|
|
|
|
, "__waStateChanged"
|
|
|
|
, "_playerEnded"
|
|
|
|
, "_playerEnded"
|
|
|
@ -66,6 +85,8 @@ _
|
|
|
|
, "_playerStop"
|
|
|
|
, "_playerStop"
|
|
|
|
, "_playerStart"
|
|
|
|
, "_playerStart"
|
|
|
|
, "_setVolume"
|
|
|
|
, "_setVolume"
|
|
|
|
|
|
|
|
, "_getItemData"
|
|
|
|
|
|
|
|
, "_getItemMediaUrl"
|
|
|
|
, "_setViewport"
|
|
|
|
, "_setViewport"
|
|
|
|
, "_updateViewportProgress"
|
|
|
|
, "_updateViewportProgress"
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -84,6 +105,9 @@ _
|
|
|
|
return that;
|
|
|
|
return that;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* PUBLIC
|
|
|
|
|
|
|
|
**/
|
|
|
|
, setPlayIndex: function (index) {
|
|
|
|
, setPlayIndex: function (index) {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -102,6 +126,9 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* EVENTS
|
|
|
|
|
|
|
|
**/
|
|
|
|
, __buttonPlayPause: function (event) {
|
|
|
|
, __buttonPlayPause: function (event) {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -138,6 +165,16 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, __buttonSeek: function (event) {
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* PRIVATE
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
// Audio Player
|
|
|
|
, _createWebAudio: function () {
|
|
|
|
, _createWebAudio: function () {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -150,6 +187,7 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Player Controls
|
|
|
|
, _playerEnded: function () {
|
|
|
|
, _playerEnded: function () {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -198,6 +236,19 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Viewport methods
|
|
|
|
|
|
|
|
, _getItemData: function (item) {
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, _getItemMediaUrl: function (item) {
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
, _setViewport: function (item) {
|
|
|
|
, _setViewport: function (item) {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
;
|
|
|
|