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

Commit

Permalink
fix: correction to bit 11 (playing status bit)
Browse files Browse the repository at this point in the history
  • Loading branch information
apexad committed Dec 8, 2020
1 parent bbc53cc commit ea3f1e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/platformAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export default class AirportExpress implements AccessoryPlugin {
}

convertMediaState(mDNS_TXT_record: Array<string>) {
const bit11 = parseInt(((parseInt(mDNS_TXT_record.find((row: string) => row.indexOf('flags') > -1)!.replace('flags=', ''), 16).toString(2)).padStart(11, '0')).charAt(0));
if (bit11 === 0) {
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;
} else if (bit11 === 1) { /* bit11 correspponds to playing https://github.com/openairplay/airplay-spec/blob/master/src/status_flags.md */
} 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;
Expand Down

0 comments on commit ea3f1e7

Please sign in to comment.