mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update volume
This commit is contained in:
parent
1b885abcb2
commit
bd391e3625
2 changed files with 41 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
|||
define(['events', 'browser', 'pluginManager', 'apphost'], function (events, browser, pluginManager, appHost) {
|
||||
define(['events', 'browser', 'pluginManager', 'apphost', 'appSettings'], function (events, browser, pluginManager, appHost, appSettings) {
|
||||
"use strict";
|
||||
|
||||
return function () {
|
||||
|
@ -15,6 +15,16 @@ define(['events', 'browser', 'pluginManager', 'apphost'], function (events, brow
|
|||
var mediaElement;
|
||||
var currentSrc;
|
||||
|
||||
function getSavedVolume() {
|
||||
return appSettings.get("volume") || 1;
|
||||
}
|
||||
|
||||
function saveVolume(value) {
|
||||
if (value) {
|
||||
appSettings.set("volume", value);
|
||||
}
|
||||
}
|
||||
|
||||
self.canPlayMediaType = function (mediaType) {
|
||||
|
||||
return (mediaType || '').toLowerCase() === 'audio';
|
||||
|
@ -263,6 +273,7 @@ define(['events', 'browser', 'pluginManager', 'apphost'], function (events, brow
|
|||
function onVolumeChange() {
|
||||
|
||||
if (!fadeTimeout) {
|
||||
saveVolume(this.volume);
|
||||
events.trigger(self, 'volumechange');
|
||||
}
|
||||
}
|
||||
|
@ -318,6 +329,8 @@ define(['events', 'browser', 'pluginManager', 'apphost'], function (events, brow
|
|||
|
||||
document.body.appendChild(elem);
|
||||
|
||||
elem.volume = getSavedVolume();
|
||||
|
||||
elem.addEventListener('timeupdate', onTimeUpdate);
|
||||
elem.addEventListener('ended', onEnded);
|
||||
elem.addEventListener('volumechange', onVolumeChange);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue