Why doesnt this work
subinznz opened this issue · 1 comments
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 won't be able to help if you copy paste example code which will obviously give erratic results (calling pause, play, stop and seek in row probably won't do what you want) without trying to understand what you're doing. I'll help you when you do. Also, please take the time to format your issue and put your code in a code block.
Closing this issue for now. Thanks for your understanding and good luck.