📺 Chromecast Sender Library for the Browser
View on GitHub
// Create new Castjs instance
const cjs = new Castjs();
// Optional metadata
var metadata = {
poster : 'https://castjs.io/media/poster.jpg',
title : 'Sintel',
description: 'Third Open Movie by Blender Foundation',
subtitles: [{
active: true,
label : 'English',
src : 'https://castjs.io/media/english.vtt'
}, {
label : 'Spanish',
src : 'https://castjs.io/media/spanish.vtt'
}],
}
// Wait for user interaction
$('#cast').on('click', () => {
if (cjs.available) {
cjs.cast('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/Sintel.mp4', metadata)
}
})