diff --git a/public/js/mstream.vue-player-controls.js b/public/js/mstream.vue-player-controls.js index 4970680..d14b83a 100644 --- a/public/js/mstream.vue-player-controls.js +++ b/public/js/mstream.vue-player-controls.js @@ -127,8 +127,6 @@ var VUEPLAYER = function () { jukeStats = JUKEBOX.stats } - - // TODO: Get volume from cookies new Vue({ el: '#mstream-player', data: { @@ -141,6 +139,12 @@ var VUEPLAYER = function () { lastVol: 100, isViz: false }, + created: function () { + if(Cookies && Cookies.get('volume')) { + this.curVol = Cookies.get('volume'); + MSTREAMPLAYER.changeVolume(parseInt(this.curVol)); + } + }, watch: { curVol: function () { // TODO: Convert to log scale before sening to mstream @@ -156,6 +160,10 @@ var VUEPLAYER = function () { // var scale = (maxv-minv) / (maxp-minp); // // var solution = Math.exp(minv + scale*(this.curVol-minp)) + if (Cookies) { + Cookies.set('volume', parseInt(this.curVol)); + } + MSTREAMPLAYER.changeVolume(parseInt(this.curVol)); } },