cast
single node routine for casting YouTube (or other ?) in webview tag
Installation
npm install @bugsounet/cast
Sample with cast contructor
const Cast = require("./index.js")
this.config = {
castName: "MagicMirror_Cast",
port: 8569
}
var debug = true
this.cast= new Cast(this.config.cast, callback, debug)
this.cast.start()
setTimeout(() => { this.cast.stop() } , 30 * 1000)
function callback(noti, castLink) {
if (noti == "CAST_START") console.log("Open this link:", castLink)
if (noti == "CAST_STOP") console.log ("Cast End")
}
constructor of cast
Cast(castConfig, callback, debug)
castConfig {}
castName
- Name of your device for reconize it in Cast appsport
- server port
callback (notification, castlink)
CAST_START
- return the url for start casting in a webview
frameCAST_STOP
- return end of casting
debug
if you want debuging information, just set to true
Functions
start()
: start cast listenerstop()
: force stop cast server
Notes
- Actually only YouTube works but may be other (in another update...)