fix some stuffs
This commit is contained in:
parent
3aca5dc92b
commit
2deaa22e71
3 changed files with 25 additions and 13 deletions
|
@ -898,6 +898,10 @@ export class BrowserWindow {
|
||||||
event.returnValue = process.platform;
|
event.returnValue = process.platform;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on("get-port", (event) => {
|
||||||
|
event.returnValue = this.clientPort;
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.on("is-dev", (event) => {
|
ipcMain.on("is-dev", (event) => {
|
||||||
event.returnValue = this.devMode;
|
event.returnValue = this.devMode;
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default class ChromecastPlugin {
|
||||||
// private GCstream = new Stream.PassThrough(),
|
// private GCstream = new Stream.PassThrough(),
|
||||||
private connectedHosts: any = {};
|
private connectedHosts: any = {};
|
||||||
private connectedPlayer: any;
|
private connectedPlayer: any;
|
||||||
// private port = false;
|
private ciderPort :any = 9000;
|
||||||
// private server = false;
|
// private server = false;
|
||||||
// private bufcount = 0;
|
// private bufcount = 0;
|
||||||
// private bufcount2 = 0;
|
// private bufcount2 = 0;
|
||||||
|
@ -148,7 +148,7 @@ export default class ChromecastPlugin {
|
||||||
}
|
}
|
||||||
let media = {
|
let media = {
|
||||||
// Here you can plug an URL to any mp4, webm, mp3 or jpg file with the proper contentType.
|
// Here you can plug an URL to any mp4, webm, mp3 or jpg file with the proper contentType.
|
||||||
contentId: 'http://' + this.getIp() + ':9000/audio.wav',
|
contentId: 'http://' + this.getIp() + ':'+ this.ciderPort +'/audio.wav',
|
||||||
contentType: 'audio/wav',
|
contentType: 'audio/wav',
|
||||||
streamType: 'LIVE', // or LIVE
|
streamType: 'LIVE', // or LIVE
|
||||||
|
|
||||||
|
@ -361,4 +361,12 @@ export default class ChromecastPlugin {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onRendererReady(): void {
|
||||||
|
this._win.webContents.executeJavaScript(
|
||||||
|
`ipcRenderer.sendSync('get-port')`
|
||||||
|
).then((result: any) => {
|
||||||
|
this.ciderPort = result;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -156,18 +156,18 @@ export default class RAOP {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const browser2 = this.mdns.createBrowser(this.mdns.tcp('airplay'));
|
// const browser2 = this.mdns.createBrowser(this.mdns.tcp('airplay'));
|
||||||
browser2.on('ready', browser2.discover);
|
// browser2.on('ready', browser2.discover);
|
||||||
|
|
||||||
browser2.on('update', (service: any) => {
|
// browser2.on('update', (service: any) => {
|
||||||
if (service.addresses && service.fullname && (service.fullname.includes('_raop._tcp') || service.fullname.includes('_airplay._tcp'))) {
|
// if (service.addresses && service.fullname && (service.fullname.includes('_raop._tcp') || service.fullname.includes('_airplay._tcp'))) {
|
||||||
// console.log(service.txt)
|
// // console.log(service.txt)
|
||||||
this._win.webContents.executeJavaScript(`console.log(
|
// this._win.webContents.executeJavaScript(`console.log(
|
||||||
"${service.name} ${service.host}:${service.port} ${service.addresses}"
|
// "${service.name} ${service.host}:${service.port} ${service.addresses}"
|
||||||
)`);
|
// )`);
|
||||||
this.ondeviceup(service.name, service.host, service.port, service.addresses, service.txt);
|
// this.ondeviceup(service.name, service.host, service.port, service.addresses, service.txt);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue