Merge pull request #222 from Froghut/preserve-chromecast-volume

Remember device volume/mute on Chromecast playback stop
This commit is contained in:
Vasily 2019-04-02 00:13:34 +03:00 committed by GitHub
commit ac0a640fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -574,8 +574,15 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
events.trigger(instance, "playbackstop", [state]); events.trigger(instance, "playbackstop", [state]);
var state = instance.lastPlayerData.PlayState || {};
var volume = state.VolumeLevel || 0.5;
var mute = state.IsMuted || false;
// Reset this so the next query doesn't make it appear like content is playing. // Reset this so the next query doesn't make it appear like content is playing.
instance.lastPlayerData = {}; instance.lastPlayerData = {};
instance.lastPlayerData.PlayState = {};
instance.lastPlayerData.PlayState.VolumeLevel = volume;
instance.lastPlayerData.PlayState.IsMuted = mute;
}); });
events.on(instance._castPlayer, "playbackprogress", function (e, data) { events.on(instance._castPlayer, "playbackprogress", function (e, data) {