thibauts / node-upnp-mediarenderer-client Goto Github PK
View Code? Open in Web Editor NEWAn UPnP/DLNA MediaRenderer client
License: MIT License
An UPnP/DLNA MediaRenderer client
License: MIT License
But i gave some issues with it.
The example with the video playing works great. But it is not possible to pause/stop or seek in the video.
Neither from the lib nor the tv.
Is this a issues with my TV or the librarie ?
Inserted:
var pInfo = et.SubElement(item, 'res');
pInfo.set('protocolInfo','http-get:*:video/mp4:*');
pInfo.text = metadata.url;
Right here: https://github.com/thibauts/node-upnp-mediarenderer-client/blob/master/index.js#L262
Tested with @jaruba for powder. My tv is a 2014 (or 13) LG without webos
subtitles: not yet tested
Additionnal note: dc:title cannot have special characters on my TV, or it won't read it. For example: "Les évadés" won't work because of the é
. If I use Les evades
as title, then it works.
Can you suggest an ssdp client to use with your module? Or mb some working examples of how you using your module?
Was trying inital test after getting Mediarender url using
https://github.com/stormboy/node-upnp-controlpoint
var MediaRendererClient = require('upnp-mediarenderer-client');
// Instanciate a client with a device description URL (discovered by SSDP)
var client = new MediaRendererClient('http://192.168.1.50:4873/urltomediarender.xml');
// Load a stream and play it immediately
client.load('http://url.to.some/stream.avi', { autoplay: true }, function(err, result) {
if(err) throw err;
console.log('playing ...');
});
Error : *****/dlna/node-upnp-mediarenderer-client/test.js:4
if(err) throw err;
^
Error: connect ECONNREFUSED
at errnoException (net.js:904:11)
at Object.afterConnect as oncomplete
Getting a Connection Refused all the time any idea why?
EDIT : Content of Mediarender.xml
https://gist.github.com/wallydz/2b363e5f92b6641619dd
I'm using node-upnp-mediarenderer-client
in a player I'm currently working on (Powder Player, currently only a windows version).
As this is a feature that will be built in the player, some may choose to stream through DLNA after they've seen 30 minutes of a video. It is only normal that the TV should start playback at minute 30 where the user requested this action. Is it possible to add a startAt
parameter to the options set for load()
?
Hello,
This almost happen only with LG Tv any idea?
Thank you !
I am facing this problem in an attempt to implement the library. This error can only be identified when I changed the code inside the node_modules folder. Other than that, there was no error return. Has anyone seen something like that and knew how to fix it?
Error: Action PrepareForConnection not implemented by service at /home/alandealmeida/Documentos/Projetos/teste/node_modules/upnp-device-client/index.js:92:17 at /home/alandealmeida/Documentos/Projetos/teste/node_modules/upnp-device-client/index.js:78:7 at /home/alandealmeida/Documentos/Projetos/teste/node_modules/upnp-device-client/index.js:559:7 at ConcatStream.<anonymous> (/home/alandealmeida/Documentos/Projetos/teste/node_modules/concat-stream/index.js:37:43) at ConcatStream.emit (events.js:327:22) at finishMaybe (/home/alandealmeida/Documentos/Projetos/teste/node_modules/readable-stream/lib/_stream_writable.js:630:14) at endWritable (/home/alandealmeida/Documentos/Projetos/teste/node_modules/readable-stream/lib/_stream_writable.js:638:3) at ConcatStream.Writable.end (/home/alandealmeida/Documentos/Projetos/teste/node_modules/readable-stream/lib/_stream_writable.js:594:41) at IncomingMessage.onend (internal/streams/readable.js:684:10) at Object.onceWrapper (events.js:421:28) { code: 'ENOACTION' }
`stream(request, response){
const file = 'https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_1920_18MG.mp4';
const mimeFile = mime.getType(file);;
const tv = new MediaRenderer('http://192.168.0.156:52323/dmr.xml');
var options = {
autoplay: true,
contentType: mimeFile,
metadata: {
title: 'Some Movie Title',
creator: 'Alan de Almeida',
type: 'video', // can be 'video', 'audio' or 'image'
}
}`
tv.load(file, options, (err, result)=>{
if(err){
console.log(err);
throw err;
}
console.log('playing...');
console.log(result);
return response.json(result);
});`
{ [Error: Resource not found (716)] code: 'EUPNP', statusCode: 500, errorCode: '716' }
Trace
at /Users/wally/po/dlna/node-upnp-mediarenderer-client/test.js:18:9
at /Users/wally/po/dlna/node-upnp-mediarenderer-client/index.js:46:22
at IncomingMessage. (/Users/wally/po/dlna/node-upnp-mediarenderer-client/node_modules/upnp-device-client/index.js:132:18)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:919:16
at process._tickCallback (node.js:419:13)
/Users/wally/po/dlna/node-upnp-mediarenderer-client/test.js:19
throw err;
^
Error: Resource not found (716)
at IncomingMessage. (/Users/wally/po/dlna/node-upnp-mediarenderer-client/node_modules/upnp-device-client/index.js:128:21)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:919:16
at process._tickCallback (node.js:419:13)
Error {stack: "Error: Action SetAVTransportURI failed (714)↵ a…16)↵ at process._tickCallback (node.js:534:11)", code: "EUPNP", statusCode: 500, errorCode: "714", message: "Action SetAVTransportURI failed (714)"…}
code: "EUPNP"
errorCode: "714"
message: "Action SetAVTransportURI failed (714)"
stack: "Error: Action SetAVTransportURI failed (714)↵ at IncomingMessage.eval (/Applications/Popcorn-Time copy.app/Contents/Resources/app.nw/node_modules/upnp-mediarenderer-client/node_modules/upnp-device-client/index.js:128:21)↵ at IncomingMessage.EventEmitter.emit (events.js:120:20)↵ at eval (_stream_readable.js:896:16)↵ at process._tickCallback (node.js:534:11)"
statusCode: 500
proto: d
"Error: Action SetAVTransportURI failed (714)
at IncomingMessage.eval (/Applications/Popcorn-Time copy.app/Contents/Resources/app.nw/node_modules/upnp-mediarenderer-client/node_modules/upnp-device-client/index.js:128:21)
at IncomingMessage.EventEmitter.emit (events.js:120:20)
at eval (_stream_readable.js:896:16)
at process._tickCallback (node.js:534:11)" app.js:452
(anonymous function) app.js:452
EventEmitter.emit events.js:120
process._fatalException node.js:164
Uncaught Error: Action SetAVTransportURI failed (714) dlna.js:34
(anonymous function) dlna.js:34
(anonymous function) /Applications/Po
Hey,
yesterday everything was working okay, but today i get this error when i try to send a video to one of my Samsung TVs:
(Everything is working for my other two Samsung TVs, and i didn't change anything...)
C:\Users\***\Documents\nodejs-projects\samsung-dlna\node_modules\upnp-device-client\index.js:571
var value = node.findtext('./' + field);
^
TypeError: Cannot read property 'findtext' of null
at C:\Users\***\Documents\nodejs-projects\samsung-dlna\node_modules\upnp-device-client\index.js:571:21
at Array.forEach (native)
at extractFields (C:\Users\***\Documents\nodejs-projects\samsung-dlna\node_modules\upnp-device-client\index.js:570:10)
at parseDeviceDescription (C:\Users\***\Documents\nodejs-projects\samsung-dlna\node_modules\upnp-device-client\index.js:440:14)
at C:\Users\***\Documents\nodejs-projects\samsung-dlna\node_modules\upnp-device-client\index.js:46:16
at C:\Users\***\Documents\nodejs-projects\samsung-dlna\node_modules\upnp-device-client\index.js:559:7
at ConcatStream.<anonymous> (C:\Users\***\Documents\nodejs-projects\samsung-dlna\node_modules\concat-stream\index.js:36:43)
at emitNone (events.js:91:20)
at ConcatStream.emit (events.js:185:7)
at finishMaybe (C:\Users\***\Documents\nodejs-projects\samsung-dlna\node_modules\readable-stream\lib\_stream_writable.js:513:14)
The error is blocking furher execution.
I wonder what is going on there.
It's neither working from my Windows PC nor my Raspberry Pi.
Even though, I can send videos per upnp from Windows Media Player to this TV...
Can you give me a hint what is going on there in the code?
This is my code by the way:
var MediaRendererClient = require('upnp-mediarenderer-client');
var options = {
autoplay: true, //play immediately
contentType: 'video/x-ms-wmv',
metadata: {
title: 'Tuer klingelt',
creator: 'Smarthome',
type: 'video' //, // can be 'video', 'audio' or 'image'
}
};
var client = new MediaRendererClient('http://192.168.178.26:7676/smp_11_');
client.load('http://*****/img/doorbell.wmv', options, function (err, result)
{
console.log(result);
if (err) throw err;
console.log('VIDEO SUCCESSFULLY SENT TO TV!');
});
Hello!
If GETting URL passed via https://github.com/thibauts/node-upnp-mediarenderer-client/blob/master/index.js#L158 results in redirect (HTTP 301/302) dumb device (such as mine ez-cast) refuses to play it.
Wonder if you could add redirect resolution here? E.g. https://gist.github.com/simonw/399280 or something more suitable.
TIA,
--Vladimir
For calls to service methods resulting in an EUPNP
error, return the spec error description corresponding to the error code.
Got this error when running example from readme...
I checked the documents and added the following header when serving the video, however, the subtitles still do not display.
I set the subtitlesUrl metadata in load()
function either.
// serve videos and subtitles using nest.js
app.useStaticAssets(config.get<string>('publicPath'), {
prefix: '/public/',
// display subtitles https://gist.github.com/thibauts/5f5f8d8ce6566c8289e6
setHeaders: (res, path) => {
const ext = extname(path);
const fileId = basename(path, ext);
if (ext === '.mp4') {
res.set('transferMode.dlna.org', 'Streaming');
res.set('contentFeatures.dlna.org', 'DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000');
res.set('CaptionInfo.sec', `http://192.168.1.107:3000/public/subtitles/${fileId}.srt`);
}
},
});
Is that mean SONY TV does not support UPnP subtitles via DIDL-Lite metadata? If so, how should I suppose to display subtitles on SONY TV?
Need your guy's help.
How about a method to efficiently destroy the node-upnp-mediarenderer-client
instance?
I can't paused video on UPnP renderer. Video itself loading correctly and playing. Then I invoke client.pause();
but nothing happens. The output is { InstanceID: 0, TransportState: 'TRANSITIONING' }
Please help me to solve how can I paused a stream. Thanks a lot.
I have installed node.js 0.12 on my MacBook Pro Yosemite. I wanted test your script but get this error:
play_media.js:8
if(err) throw err;
^
Error: socket hang up
at createHangUpError (_http_client.js:215:15)
at Socket.socketOnEnd (_http_client.js:293:23)
at Socket.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)
Have an idea?
Regards,
Alinos38
With gmediarender-resurrect
installed on RPi 3, how can this node module be used as a control point from the Pi terminal?
Is this to be modified? What should be in place of the url
, since audio is being streamed from an Android and played from the Pi itself?
client.load('http://url.to.some/stream.avi', options, function(err, result) {
if(err) throw err;
console.log('playing ...');
});
Or is there some other initialization?
Hi feross
good work on this, fans and clean :)
just three idears
1/ have right click to poste http link or drag n drop of .torrent links not only magnets
2/ and think this is one is a real problem ... :)
exemple:
i start a torrent, the player start then tell me "video or audio codec not supported", ok but now i have a chromecast/upnp/airplay player and want to send the file on one of them
i can t ! if i m right there s not global settings and in your popup i only have the choice to open an external player or cancel ( then it return to homepage)
think you can simply add a select in the audio/video popup with the detected devices with a label like 'send to network player'
cancel | open with external player | open with network player
3/ a transcoder thru ffmpeg to play any codecs in the app player :)
just an idear :)...
thanks
Some TV sets (at least one tested Samsung) require special DLNA headers to be sent by the file server when responding to requests. We should provide an example server with the right headers set.
I was trying to follow your example , but I could not get it to work, im trying to get this video http://www.w3schools.com/html/mov_bbb.mp4 on my samsung tv using upnp.
"
var MediaRendererClient = require('upnp-mediarenderer-client');
// Instanciate a client with a device description URL (discovered by SSDP)
var client = new MediaRendererClient('http://192.168.1.6:52235/dmr/SamsungMRDesc.xml');
// Load a stream with subtitles and play it immediately
var options = {
autoplay: true,
contentType: 'video/avi',
metadata: {
title: 'Some Movie Title',
creator: 'John Doe',
type: 'video', // can be 'video', 'audio' or 'image'
// subtitlesUrl: 'http://url.to.some/subtitles.srt'
}
};
client.load('var MediaRendererClient = require('upnp-mediarenderer-client');
// Instanciate a client with a device description URL (discovered by SSDP)
var client = new MediaRendererClient('http://192.168.1.6:52235/dmr/SamsungMRDesc.xml');
// Load a stream with subtitles and play it immediately
var options = {
autoplay: true,
contentType: 'video/avi',
metadata: {
title: 'Some Movie Title',
creator: 'John Doe',
type: 'video', // can be 'video', 'audio' or 'image'
// subtitlesUrl: 'http://url.to.some/subtitles.srt'
}
};
client.load('http://www.w3schools.com/html/mov_bbb.mp4', options, function(err, result) {
if(err) throw err;
console.log('playing ...');
});
// Pause the current playing stream
client.pause();
// Unpause
client.play();
// Stop
client.stop();
// Seek to 10 minutes
client.seek(10 * 60);
client.on('status', function(status) {
// Reports the full state of the AVTransport service the first time it fires,
// then reports diffs. Can be used to maintain a reliable copy of the
// service internal state.
console.log(status);
});
client.on('loading', function() {
console.log('loading');
});
client.on('playing', function() {
console.log('playing');
client.getPosition(function(err, position) {
console.log(position); // Current position in seconds
});
client.getDuration(function(err, duration) {
console.log(duration); // Media duration in seconds
});
});
client.on('paused', function() {
console.log('paused');
});
client.on('stopped', function() {
console.log('stopped');
});
client.on('speedChanged', function(speed) {
// Fired when the user rewinds of fast-forwards the media from the remote
console.log('speedChanged', speed);
});, options, function(err, result) {
if(err) throw err;
console.log('playing ...');
});
// Pause the current playing stream
client.pause();
// Unpause
client.play();
// Stop
client.stop();
// Seek to 10 minutes
client.seek(10 * 60);
client.on('status', function(status) {
// Reports the full state of the AVTransport service the first time it fires,
// then reports diffs. Can be used to maintain a reliable copy of the
// service internal state.
console.log(status);
});
client.on('loading', function() {
console.log('loading');
});
client.on('playing', function() {
console.log('playing');
client.getPosition(function(err, position) {
console.log(position); // Current position in seconds
});
client.getDuration(function(err, duration) {
console.log(duration); // Media duration in seconds
});
});
client.on('paused', function() {
console.log('paused');
});
client.on('stopped', function() {
console.log('stopped');
});
client.on('speedChanged', function(speed) {
// Fired when the user rewinds of fast-forwards the media from the remote
console.log('speedChanged', speed);
});
"
I am having trouble to stream to xbox360 maybe because i am having this error on the xml
This page contains the following errors:
error on line 2 at column 21: xmlns:ms: ' urn:microsoft-com:wmc-1-0' is not a valid URI
Below is a rendering of the page up to the first error.
Would it be possible to load a playlist of videos?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.