You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
215 lines
3.0 KiB
215 lines
3.0 KiB
/*jslint laxbreak:true */
|
|
/*jslint laxcomma:true */
|
|
/*jslint loopfunc:true */
|
|
/*jslint strict:true */
|
|
/*jslint browser:true */
|
|
/*jslint devel:true */
|
|
define([
|
|
"underscore"
|
|
, "jquery"
|
|
, "backbone"
|
|
|
|
, "text!../../templates/player/layout.html"
|
|
, "text!../../templates/player/player-status.html"
|
|
]
|
|
, function (
|
|
_
|
|
, $
|
|
, Backbone
|
|
|
|
, tmplPlayerLayout
|
|
, tmplPlayerStatus
|
|
) {
|
|
"use strict";
|
|
|
|
var Player = Backbone.View.extend({
|
|
elViewport: null
|
|
, $elViewport: null
|
|
|
|
, playIndex: []
|
|
|
|
, playCursor: 0
|
|
|
|
, webAudio: null
|
|
|
|
, _stateRandom: null
|
|
|
|
, _stateRepeat: null
|
|
|
|
, _stateMute: null
|
|
|
|
, _stateVolume: null
|
|
|
|
, _stateAudio: null
|
|
|
|
, initialize: function (options) {
|
|
var that = this
|
|
;
|
|
|
|
_.bindAll(this
|
|
, "setPlayIndex"
|
|
, "setRandomState"
|
|
, "setRepeatState"
|
|
, "__buttonPlayPause"
|
|
, "__buttonNext"
|
|
, "__buttonPrevious"
|
|
, "__buttonVolumeUp"
|
|
, "__buttonVolumeDown"
|
|
, "__buttonVolumeClick"
|
|
, "_createWebAudio"
|
|
, "__waStateChanged"
|
|
, "_playerEnded"
|
|
, "_playerLoading"
|
|
, "_playNext"
|
|
, "_playPrevious"
|
|
, "_playerPause"
|
|
, "_playerStop"
|
|
, "_playerStart"
|
|
, "_setVolume"
|
|
, "_setViewport"
|
|
, "_updateViewportProgress"
|
|
);
|
|
|
|
Player.__super__.initialize.apply(that);
|
|
|
|
that.$el.html(tmplPlayerLayout);
|
|
|
|
that.elViewport = document.createElement("div");
|
|
that.$elViewport = $(that.elViewport);
|
|
|
|
that.$elViewport.html(_.template(tmplPlayerStatus)({}));
|
|
|
|
that.$el.append(that.elViewport);
|
|
|
|
return that;
|
|
}
|
|
|
|
, setPlayIndex: function (index) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, setRandomState: function (random) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, setRepeatState: function (random) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, __buttonPlayPause: function (event) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, __buttonNext: function (event) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, __buttonPrevious: function (event) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, __buttonVolumeUp: function (event) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, __buttonVolumeDown: function (event) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, __buttonVolumeClick: function (event) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _createWebAudio: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, __waStateChanged: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _playerEnded: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _playerLoading: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _playNext: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _playPrevious: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _playerPause: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _playerStop: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _playerStart: function () {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _setVolume: function (volume) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _setViewport: function (item) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
|
|
, _updateViewportProgress: function (progress, time) {
|
|
var that = this
|
|
;
|
|
|
|
}
|
|
});
|
|
|
|
return Player;
|
|
}); |