From fadaf9785f890f9240163d1bfe3a3ad74abb3469 Mon Sep 17 00:00:00 2001 From: Techywarrior Date: Wed, 27 Mar 2013 18:02:34 -0700 Subject: [PATCH] remember volume on local client for video player --- dashboard-ui/scripts/mediaplayer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index 4f248d3bf1..a61831f062 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -117,6 +117,8 @@ var screenWidth = Math.max(screen.height, screen.width); var screenHeight = Math.min(screen.height, screen.width); + var volume = localStorage.getItem("volume") || 0.5; + var baseParams = { audioChannels: 2, audioBitrate: 128000, @@ -167,7 +169,8 @@ { type: "video/mp4", src: mp4VideoUrl }, { type: "video/mp2t; codecs='h264, aac'", src: tsVideoUrl }, { type: "application/x-mpegURL", src: hlsVideoUrl }, - { type: "video/ogg", src: ogvVideoUrl }]); + { type: "video/ogg", src: ogvVideoUrl }] + ).volume(volume); videoJSextension.setup_video( $( '#videoWindow' ), item ); @@ -180,6 +183,10 @@ $(".vjs-remaining-time-display").show(); }); + (this).addEvent("volumechange",function(){ + localStorage.setItem("volume", (this).volume()); + }); + (this).addEvent("play", MediaPlayer.updateProgress); ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), item.Id);