From afe14c2128b58bbc29eb83707cea34f6330ca420 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 2 Jan 2014 00:13:45 -0500 Subject: [PATCH] Save volume in localStorage --- www/assets/js/callbacks.js | 1 + www/assets/js/data.js | 3 ++- www/assets/js/player.js | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index be1732b9..75b53c8a 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -1013,6 +1013,7 @@ Callbacks = { console.log('getting volume for', PLAYER.type); PLAYER.getVolume(function (v) { VOLUME = v; + setOpt("volume", VOLUME); }); } diff --git a/www/assets/js/data.js b/www/assets/js/data.js index 0733a562..ce88422c 100644 --- a/www/assets/js/data.js +++ b/www/assets/js/data.js @@ -36,7 +36,6 @@ var CHANNEL = { }; var PLAYER = false; -var VOLUME = 1; var VIDEOQUALITY = false; var FLUIDLAYOUT = false; var VWIDTH; @@ -124,6 +123,8 @@ var USEROPTS = { secure_connection : getOrDefault("secure_connection", false) }; +var VOLUME = getOrDefault("volume", 1); + var NO_WEBSOCKETS = USEROPTS.altsocket; var Rank = { diff --git a/www/assets/js/player.js b/www/assets/js/player.js index 72d9ebd7..60838da7 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -174,8 +174,6 @@ var VimeoPlayer = function (data) { }.bind(self)); }; - self.init(); - self.load = function (data) { self.videoId = data.id; self.videoLength = data.seconds; @@ -217,6 +215,8 @@ var VimeoPlayer = function (data) { self.setVolume = function (vol) { self.player.api("setVolume", vol); }; + + self.init(); }); }; @@ -282,8 +282,6 @@ var VimeoFlashPlayer = function (data) { }); }; - self.init(); - self.load = function (data) { self.videoId = data.id; self.videoLength = data.seconds; @@ -323,6 +321,8 @@ var VimeoFlashPlayer = function (data) { self.setVolume = function (vol) { self.player.api_setVolume(vol); }; + + self.init(); }; var DailymotionPlayer = function (data) {