1
0
Fork 0

Moar player logic

master
Matthieu Lalonde 12 years ago
parent 24522b0315
commit 96c63e6e5c

@ -58,7 +58,7 @@ _
, playIndex: [] , playIndex: []
, playCursor: 0 , playCursor: -1
, webAudio: null , webAudio: null
@ -194,11 +194,13 @@ _
var that = this var that = this
; ;
if (that.webAudio._state === that.webAudio._states.loading) { if (that.webAudio._state === that.webAudio._states.paused) {
that.webAudio._state = that.webAudio._states.stopped;
that._playerStop(); that._playerStop();
} }
if (that.webAudio._state < that.webAudio._states.loading) { if (that.webAudio._state < that.webAudio._states.loading) {
console.debug("Setting Play Index");
that._playIndex = index; that._playIndex = index;
that._playCursor = cursor || 0; that._playCursor = cursor || 0;
@ -224,12 +226,20 @@ _
; ;
if (random === true) { if (random === true) {
that._playIndexOrdered = that._playIndex; //var previousItem = that._playIndex[that._playCursor];
that._playIndexOrdered = _.clone(that._playIndex);
that._playIndex.shuffle(); that._playIndex.shuffle();
// TODO: Set cursor back to the item that was playing // TODO: Set cursor back to the item that was playing
//if (that._playCursor !== -1 && that.webAudio._state >= that.webAudio._states.loading) {
// var newCursor =
//}
that._playCursor = -1;
} else { } else {
that._playIndex = that._playIndexOrdered; that._playIndex = _.clone(that._playIndexOrdered);
delete that._playIndexOrdered;
} }
return that._stateRandom = random; return that._stateRandom = random;
@ -526,7 +536,7 @@ _
that.webAudio.obj.src = ""; that.webAudio.obj.src = "";
that.webAudio.obj.innetHTML = ""; that.webAudio.obj.innetHTML = "";
that._playCursor = 0; that._playCursor = -1;
that._setViewport(); that._setViewport();
} }

@ -23,4 +23,4 @@
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-mini btn-primary" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i>&nbsp;Close</button> <button class="btn btn-mini btn-primary" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i>&nbsp;Close</button>
</div> </div>
</div> </div>

@ -14,4 +14,4 @@
<button class="btn btn-mini btn-primary" data-dismiss="modal" aria-hidden="true"><i class="icon-refresh"></i>&nbsp;Reload</button> <button class="btn btn-mini btn-primary" data-dismiss="modal" aria-hidden="true"><i class="icon-refresh"></i>&nbsp;Reload</button>
</div> </div>
</div> </div>
</div> </div>

@ -27,4 +27,4 @@
<button class="btn btn-mini btn-primary" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i>&nbsp;Close</button> <button class="btn btn-mini btn-primary" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i>&nbsp;Close</button>
</div> </div>
</div> </div>
</div> </div>
Loading…
Cancel
Save