var ChromecastAPI = require('chromecast-api')
var chromeCast = function(content , contentType , timeseek){
var browser = new ChromecastAPI.Browser()
console.log("browser api");
browser.on('deviceOn', function (device) {
var urlMedia = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4';
console.log("\n content is "+ content);;
device.play(content, 0, function () {
console.log('Playing in your chromecast ' + timeseek)
if (timeseek) {
device.seek(timeseek,function (err) {
if (err) console.log('Seek forward: ERROR')
else console.log('Seek forward: SUCCESS')
})
}
})
})
}
module.exports.chromeCast = chromeCast;
// to use in other node js file --> var chromeCast = require('./test.js');
var chromeCast = function(content , contentType , timeseek){
var browser = new ChromecastAPI.Browser()
console.log("browser api");
browser.on('deviceOn', function (device) {
var urlMedia = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4';
console.log("\n content is "+ content);;
device.play(content, 0, function () {
console.log('Playing in your chromecast ' + timeseek)
if (timeseek) {
device.seek(timeseek,function (err) {
if (err) console.log('Seek forward: ERROR')
else console.log('Seek forward: SUCCESS')
})
}
})
})
}
module.exports.chromeCast = chromeCast;
// to use in other node js file --> var chromeCast = require('./test.js');
Comments
Post a Comment