Skip to main content

Cast to Device

The Casting Manager utility allows you to stream an eyeson meeting to a Chromecast-enabled TV or compatible device, showing only the video. This feature is ideal for presenting on a larger screen without on-screen controls or distractions, enhancing focus during meetings, demos, or presentations.

Available since v2.1.0.

Support

Cast to Device is supported in Chromium-based browsers like Chrome, Edge, and Opera, and works with devices such as Google Chromecast, Google Cast, and Cast-enabled TVs.

Code Example

<button type="button" id="button-cast" disabled>Start</button>

<script type="module">
import eyeson, { FeatureDetector } from '@eyeson/js';

const { castingManager } = eyeson;
const buttonCast = document.getElementById('button-cast');

if (FeatureDetector.canCast() === true) {
buttonCast.disabled = castingManager.blocked;

castingManager.onUpdate((event) => {
const { type } = event;
if (type === 'connected') {
buttonCast.textContent = 'Stop';
}
else if (type === 'terminated') {
buttonCast.textContent = 'Start';
}
else if (type === 'error') {
alert(event.error.toString());
}
else if (type === 'change_blocked') {
buttonCast.disabled = castingManager.blocked;
}
});

buttonCast.addEventListener('click', () => {
if (castingManager.connected) {
castingManager.stop();
}
else {
castingManager.start();
}
});
}
</script>

Available Methods

castingManager.start();
// castingManager.start({ muted: true, includeLocalAudio: false });

castingManager.stop();

castingManager.onUpdate(event => {...});

castingManager.offUpdate(); // empty for all listener or provide a specific one

castingManager.sendMessage('toast message');

castingManager.setMuted(true/false);

castingManager.setIncludeLocalAudio(true/false);
Heads-up

You can unmute and enable local audio on the device, but it’s highly recommended to keep it muted to prevent audio feedback loops. Use unmute only when the device (like a TV or monitor) is in a separate room, ensuring no shared microphone-speaker environment.

Boolean Properties

castingManager.supported // same as FeatureDetector.canCast()

castingManager.connected

castingManager.muted

castingManager.blocked

Events

castingManager.onUpdate((event) => {
const { type } = event;
if (type === 'connected') {
// casting active
}
if (type === 'terminated') {
// casting ended
}
if (type === 'change_available') {
// casting devices are available
}
if (type === 'change_blocked') {
// only one casting at a time is allowed
}
if (type === 'error') {
// log(event.error);
}
});