casting fix

This commit is contained in:
vapormusic 2022-08-31 17:44:39 +07:00
parent af27a3cd72
commit 8c9070c8da
2 changed files with 14 additions and 9 deletions

View file

@ -29,6 +29,7 @@ export default class ChromecastPlugin {
private connectedHosts: any = {}; private connectedHosts: any = {};
private connectedPlayer: any; private connectedPlayer: any;
private ciderPort: any = 9000; private ciderPort: any = 9000;
private scanCount: any = 0;
// private server = false; // private server = false;
// private bufcount = 0; // private bufcount = 0;
// private bufcount2 = 0; // private bufcount2 = 0;
@ -318,6 +319,9 @@ export default class ChromecastPlugin {
}); });
electron.ipcMain.on("getChromeCastDevices", (_event, _data) => { electron.ipcMain.on("getChromeCastDevices", (_event, _data) => {
if(this.scanCount++ == 2) {
this.scanCount = 0
this.castDevices = [];}
this.searchForGCDevices(); this.searchForGCDevices();
}); });

View file

@ -217,6 +217,7 @@ export default class RAOP {
txt: txt, txt: txt,
airplay2: airplay2dv, airplay2: airplay2dv,
debug: null, debug: null,
forceAlac: false
}); });
// console.log('lol',txt) // console.log('lol',txt)
this.device.on("status", (status: any) => { this.device.on("status", (status: any) => {
@ -235,15 +236,15 @@ export default class RAOP {
this._win.webContents.executeJavaScript(`app.sendAirPlayFailed()`); this._win.webContents.executeJavaScript(`app.sendAirPlayFailed()`);
} }
if (status == "stopped") { if (status == "stopped") {
this.airtunes.stopAll(() => { // this.airtunes.stopAll(() => {
console.log("end"); // console.log("end");
}); // });
this._win.webContents.executeJavaScript(`app.airplayDisconnect(true, ${[ipv4, ipport, sepassword, title, artist, album, artworkURL, txt, airplay2dv]})`).catch((err: any) => console.error(err)); // this._win.webContents.executeJavaScript(`app.airplayDisconnect(true, ${[ipv4, ipport, sepassword, title, artist, album, artworkURL, txt, airplay2dv]})`).catch((err: any) => console.error(err));
this.airtunes = null; // this.airtunes = null;
this.device = null; // this.device = null;
this.ipairplay = ""; // this.ipairplay = "";
this.portairplay = ""; // this.portairplay = "";
this.ok = 1; // this.ok = 1;
} else { } else {
setTimeout(() => { setTimeout(() => {
if (this.ok == 1) { if (this.ok == 1) {