Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manrueda/renderer-finder
DLNA renderer finder
https://github.com/manrueda/renderer-finder
Last synced: 3 days ago
JSON representation
DLNA renderer finder
- Host: GitHub
- URL: https://github.com/manrueda/renderer-finder
- Owner: manrueda
- License: mit
- Created: 2015-09-01T21:57:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-21T11:42:42.000Z (almost 9 years ago)
- Last Synced: 2024-10-16T10:32:57.473Z (29 days ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Renderer Finder
This module provides an event driven way of obtain all the DLNA renderers present in the network.## Usage
The module can be used to get the first renderer found or keep listening to new ones.### Getting only one
```javascript
var RendererFinder = require('renderer-finder');
var finder = new RendererFinder();finder.findOne(function(err, info, msg){
console.log(info);
console.log(msg);
});
```
The callback receive the ```info``` parameter with a basic data of the address of the renderer. The ```msg``` parameter contains the ```M-SEARCH``` parsed response data as a JSON.Additionally you can ask for more data to the renderer. To do this you need to pass a ```true``` as the first parameter and the callback as a second parameter.
```javascript
finder.findOne(true, function(err, info, msg, desc){
console.log(info);
console.log(msg);
console.log(desc);
});
```The ```desc``` parameter contains the data of the DLNA description asked to the renderer.
### Event driven mode
The event driven mode have all the same capabilities of the 'get only one' mode but the finder keep looking for more renderers until you say stop.To ask for more data, you need to pass ```true``` as the first parameter in the ```start``` method.
```javascript
finder.on('found', function(info, msg, desc){
console.log(info);
console.log(msg);
console.log(desc);
});finder.start(true);
```To stop searching you only need to call stop:
```javascript
finder.stop();
```
### Search for another devices
The constructor of the finder support a custom ST as the first parameter to search for custom devices.The default ST is ```urn:schemas-upnp-org:device:MediaRenderer:1```
```javascript
var RendererFinder = require('renderer-finder');
var finder = new RendererFinder('urn:schemas-upnp-org:device:Basic:1');finder.findOne(function(err, info, msg){
console.log(info);
console.log(msg);
});
```