查询本地网络中的 Chromecast 设备,并让它们播放媒体
查询本地网络中的 Chromecast 设备,并让它们播放媒体
npm install chromecasts --saveconst chromecasts = require('chromecasts')()
chromecasts.on('update', players => {
console.log('all players: ', players)
player.play('http://example.com/my-video.mp4', {title: 'my video', type: 'video/mp4'})
})var list = chromecasts()创建 Chromecast 列表。
在创建新列表时,它会调用 list.update() 一次。
如果您想更新列表,则可以在之后进行调用。
list.update()通过查询本地网络中的 Chromecast 实例来更新播放器列表。
list.on('update', player)当在本地网络中找到新的玩家时发出通知
player.play(url, [opts], cb)让播放器播放一个 URL。可选项包括:
{
title: 'My movie',
type: 'video/mp4',
seek: seconds, // start by seeking to this offset
subtitles: ['http://example.com/sub.vtt'], // subtitle track 1,
autoSubtitles: true // enable first track if you provide subs
}player.subtitles(track, [cb])启用字幕轨道。使用 player.subtitles(false) 来禁用字幕
暂无开放 Issues,或尚未同步最近议题。