* VRFS-3165 - stop preview widget by using pause, VRFS-3174 - stop preview when you leave page
This commit is contained in:
parent
73e422a2cc
commit
17ce9f641d
|
|
@ -73,6 +73,8 @@ context.JK.JamTrackPreview = class JamTrackPreview
|
|||
urls.push(@jamTrackTrack.preview_ogg_url)
|
||||
|
||||
@no_audio = false
|
||||
@root.on('remove', @onDestroyed);
|
||||
|
||||
@sound = new Howl({
|
||||
src: urls,
|
||||
autoplay: false,
|
||||
|
|
@ -86,6 +88,9 @@ context.JK.JamTrackPreview = class JamTrackPreview
|
|||
@playButton.addClass('disabled')
|
||||
@stopButton.addClass('disabled')
|
||||
|
||||
onDestroyed: () =>
|
||||
@sound.unload()
|
||||
|
||||
removeNowPlaying: () =>
|
||||
context.JK.JamTrackPreview.nowPlaying.splice(this)
|
||||
if context.JK.JamTrackPreview.nowPlaying.length > 0
|
||||
|
|
@ -118,7 +123,7 @@ context.JK.JamTrackPreview = class JamTrackPreview
|
|||
|
||||
issueStop: () =>
|
||||
@logger.debug("stop issued for jam track preview")
|
||||
@sound.stop()
|
||||
@sound.pause() # stop does not actually stop in windows client
|
||||
@stopButton.addClass('hidden')
|
||||
@playButton.removeClass('hidden')
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,10 @@ context.JK.JamTrackScreen=class JamTrackScreen
|
|||
this.refresh()
|
||||
|
||||
afterShow:(data) =>
|
||||
|
||||
|
||||
beforeHide: () =>
|
||||
this.clearResults();
|
||||
|
||||
events:() =>
|
||||
@genre.on 'change', this.search
|
||||
@artist.on 'change', this.search
|
||||
|
|
@ -283,6 +286,7 @@ context.JK.JamTrackScreen=class JamTrackScreen
|
|||
screenBindings =
|
||||
'beforeShow': this.beforeShow
|
||||
'afterShow': this.afterShow
|
||||
'beforeHide' : this.beforeHide
|
||||
@app.bindScreen 'jamtrackBrowse', screenBindings
|
||||
@screen = $('#jamtrack-find-form')
|
||||
@scroller = @screen.find('.content-body-scroller')
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@
|
|||
var self = this || Howler;
|
||||
var audioTest = new Audio();
|
||||
var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, '');
|
||||
|
||||
|
||||
self._codecs = {
|
||||
mp3: !!(mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, '')),
|
||||
mpeg: !!mpegTest,
|
||||
|
|
@ -498,9 +498,9 @@
|
|||
|
||||
// Play the sound using the supported method.
|
||||
if (typeof node.bufferSource.start === 'undefined') {
|
||||
node.bufferSource.noteGrainOn(0, seek, duration);
|
||||
sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration);
|
||||
} else {
|
||||
node.bufferSource.start(0, seek, duration);
|
||||
sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration);
|
||||
}
|
||||
|
||||
// Start a new timer if none is present.
|
||||
|
|
@ -852,7 +852,7 @@
|
|||
var dir = from > to ? 'out' : 'in';
|
||||
var steps = diff / 0.01;
|
||||
var stepLen = len / steps;
|
||||
|
||||
|
||||
(function() {
|
||||
var vol = from;
|
||||
var interval = setInterval(function(id) {
|
||||
|
|
@ -1157,7 +1157,7 @@
|
|||
_emit: function(event, id, msg) {
|
||||
var self = this;
|
||||
var events = self['_on' + event];
|
||||
|
||||
|
||||
// Loop through event store and fire all functions.
|
||||
for (var i=0; i<events.length; i++) {
|
||||
if (!events[i].id || events[i].id === id) {
|
||||
|
|
@ -1430,7 +1430,7 @@
|
|||
|
||||
// Fire an error event and pass back the code.
|
||||
self._parent._emit('loaderror', self._id, self._node.error ? self._node.error.code : 0);
|
||||
|
||||
|
||||
// Clear the event listener.
|
||||
self._node.removeEventListener('error', self._errorListener, false);
|
||||
},
|
||||
|
|
@ -1513,7 +1513,7 @@
|
|||
for (var i=0; i<data.length; ++i) {
|
||||
dataView[i] = data.charCodeAt(i);
|
||||
}
|
||||
|
||||
|
||||
decodeAudioData(dataView.buffer, self);
|
||||
} else {
|
||||
// Load the buffer from the URL.
|
||||
|
|
@ -1648,4 +1648,4 @@
|
|||
window.Howl = Howl;
|
||||
window.Sound = Sound;
|
||||
}
|
||||
})();
|
||||
})();
|
||||
Loading…
Reference in New Issue