Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
fix: use STOPPED if Airport Express not connected/Playing, INTERRUPTE…
Browse files Browse the repository at this point in the history
…D if error
  • Loading branch information
apexad committed Dec 9, 2020
1 parent d2e41d4 commit 6b1c32a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/platformAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ export default class AirportExpress implements AccessoryPlugin {
convertMediaState(mDNS_TXT_record: Array<string>) {
const bit11 = (parseInt(mDNS_TXT_record.find((r: string) => r.indexOf('flag') > -1)!.replace('flags=', ''), 16).toString(2)).padStart(12, '0').charAt(0);
if (bit11 === '0') {
return this.hap.Characteristic.CurrentMediaState.PAUSE;
return this.hap.Characteristic.CurrentMediaState.STOP;
} else if (bit11 === '1') { /* bit11 correspponds to playing https://github.com/openairplay/airplay-spec/blob/master/src/status_flags.md */
return this.hap.Characteristic.CurrentMediaState.PLAY;
}
return this.hap.Characteristic.CurrentMediaState.STOP;
return this.hap.Characteristic.CurrentMediaState.INTERRUPTED;
}

updateMediaState() {
Expand Down

0 comments on commit 6b1c32a

Please sign in to comment.