Manually set media src to fix equalizer bug

This commit is contained in:
An Phan 2016-02-21 15:03:48 +08:00
parent 15af325370
commit 921b8a66c7

View file

@ -34,6 +34,8 @@ export default {
controls: [],
})[0];
this.audio = $('audio');
this.$volumeInput = $('#volumeRange');
/**
@ -103,11 +105,9 @@ export default {
// Add it into the "recent" list
songStore.addRecent(song);
this.player.source({
sources: [{
src: `${sharedStore.state.cdnUrl}api/${song.id}/play?jwt-token=${ls.get('jwt-token')}`,
}]
});
// Manually set the `src` attribute of the audio to prevent plyr from resetting
// the audio media object and cause our equalizer to malfunction.
this.player.media.src = `${sharedStore.state.cdnUrl}api/${song.id}/play?jwt-token=${ls.get('jwt-token')}`;
$('title').text(`${song.title}${config.appTitle}`);
$('.plyr audio').attr('title', `${song.album.artist.name} - ${song.title}`);