add dlna and ui fixes
This commit is contained in:
parent
d5ade09aa7
commit
a023bd619c
10 changed files with 64 additions and 46 deletions
|
@ -2,6 +2,7 @@ import * as electron from "electron";
|
|||
import * as os from "os";
|
||||
import { resolve } from "path";
|
||||
import * as CiderReceiver from "../base/castreceiver";
|
||||
const MediaRendererClient = require('upnp-mediarenderer-client')
|
||||
|
||||
export default class ChromecastPlugin {
|
||||
/**
|
||||
|
@ -14,6 +15,7 @@ export default class ChromecastPlugin {
|
|||
private _timer: any;
|
||||
private audioClient = require("castv2-client").Client;
|
||||
private mdns = require("mdns-js");
|
||||
|
||||
|
||||
private devices: any = [];
|
||||
private castDevices: any = [];
|
||||
|
@ -67,19 +69,17 @@ export default class ChromecastPlugin {
|
|||
|
||||
ssdpBrowser.search("urn:dial-multiscreen-org:device:dial:1");
|
||||
|
||||
// // actual upnp devices
|
||||
// if (app.cfg.get("audio.enableDLNA")) {
|
||||
// let ssdpBrowser2 = new Client();
|
||||
// ssdpBrowser2.on('response', (headers, statusCode, rinfo) => {
|
||||
// var location = getLocation(headers);
|
||||
// if (location != null) {
|
||||
// this.getServiceDescription(location, rinfo.address);
|
||||
// }
|
||||
// actual upnp devices
|
||||
let ssdpBrowser2 = new Client();
|
||||
ssdpBrowser2.on('response', (headers: any, statusCode: any, rinfo: any) => {
|
||||
var location = getLocation(headers);
|
||||
if (location != null) {
|
||||
this.getServiceDescription(location, rinfo.address);
|
||||
}
|
||||
|
||||
// });
|
||||
// ssdpBrowser2.search('urn:schemas-upnp-org:device:MediaRenderer:1');
|
||||
});
|
||||
ssdpBrowser2.search('urn:schemas-upnp-org:device:MediaRenderer:1');
|
||||
|
||||
// }
|
||||
} catch (e) {
|
||||
console.log("Search GC err", e);
|
||||
}
|
||||
|
@ -257,26 +257,26 @@ export default class ChromecastPlugin {
|
|||
});
|
||||
} else {
|
||||
// upnp devices
|
||||
//try {
|
||||
// client = new MediaRendererClient(UPNPDesc);
|
||||
// const options = {
|
||||
// autoplay: true,
|
||||
// contentType: 'audio/x-wav',
|
||||
// dlnaFeatures: 'DLNA.ORG_PN=-;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000',
|
||||
// metadata: {
|
||||
// title: 'Apple Music Electron',
|
||||
// creator: 'Streaming ...',
|
||||
// type: 'audio', // can be 'video', 'audio' or 'image'
|
||||
// // url: 'http://' + getIp() + ':' + server.address().port + '/',
|
||||
// // protocolInfo: 'DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000;
|
||||
// }
|
||||
// };
|
||||
// client.load('http://' + getIp() + ':' + server.address().port + '/a.wav', options, function (err, _result) {
|
||||
// if (err) throw err;
|
||||
// console.log('playing ...');
|
||||
// });
|
||||
// } catch (e) {
|
||||
// }
|
||||
try {
|
||||
let client = new MediaRendererClient(UPNPDesc);
|
||||
const options = {
|
||||
autoplay: true,
|
||||
contentType: 'audio/x-wav',
|
||||
dlnaFeatures: 'DLNA.ORG_PN=-;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000',
|
||||
metadata: {
|
||||
title: 'Cider',
|
||||
creator: 'Streaming ...',
|
||||
type: 'audio', // can be 'video', 'audio' or 'image'
|
||||
// url: 'http://' + getIp() + ':' + server.address().port + '/',
|
||||
// protocolInfo: 'DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000;
|
||||
}
|
||||
};
|
||||
client.load('http://' + this.getIp() + ':' + this.ciderPort + '/audio.wav', options, function (err: any, _result: any) {
|
||||
if (err) throw err;
|
||||
console.log('playing ...');
|
||||
});
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue