mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 10:09:59 +00:00
Handle missing volume in status messages
This commit is contained in:
@@ -56,8 +56,6 @@ export default class Media {
|
|||||||
|
|
||||||
const messageData = {
|
const messageData = {
|
||||||
_lastCurrentTime: Date.now() / 1000
|
_lastCurrentTime: Date.now() / 1000
|
||||||
, _volumeLevel: status.volume.level
|
|
||||||
, _volumeMuted: status.volume.muted
|
|
||||||
|
|
||||||
, currentTime: status.currentTime
|
, currentTime: status.currentTime
|
||||||
, customData: status.customData
|
, customData: status.customData
|
||||||
@@ -66,6 +64,11 @@ export default class Media {
|
|||||||
, repeatMode: status.repeatMode
|
, repeatMode: status.repeatMode
|
||||||
} as UpdateMessageData;
|
} as UpdateMessageData;
|
||||||
|
|
||||||
|
if (status.volume) {
|
||||||
|
messageData._volumeLevel = status.volume.level
|
||||||
|
messageData._volumeMuted = status.volume.muted
|
||||||
|
}
|
||||||
|
|
||||||
if (status.media) {
|
if (status.media) {
|
||||||
messageData.media = status.media;
|
messageData.media = status.media;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,13 +92,16 @@ export default class Media {
|
|||||||
this.currentTime = status.currentTime;
|
this.currentTime = status.currentTime;
|
||||||
_lastCurrentTime.set(this, status._lastCurrentTime);
|
_lastCurrentTime.set(this, status._lastCurrentTime);
|
||||||
this.customData = status.customData;
|
this.customData = status.customData;
|
||||||
this.volume = new Volume(
|
|
||||||
status._volumeLevel
|
|
||||||
, status._volumeMuted);
|
|
||||||
this.playbackRate = status.playbackRate;
|
this.playbackRate = status.playbackRate;
|
||||||
this.playerState = status.playerState;
|
this.playerState = status.playerState;
|
||||||
this.repeatMode = status.repeatMode;
|
this.repeatMode = status.repeatMode;
|
||||||
|
|
||||||
|
if (status.volume) {
|
||||||
|
this.volume = new Volume(
|
||||||
|
status._volumeLevel
|
||||||
|
, status._volumeMuted);
|
||||||
|
}
|
||||||
|
|
||||||
if (status.media) {
|
if (status.media) {
|
||||||
this.media = status.media;
|
this.media = status.media;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user