Skip to content

Instantly share code, notes, and snippets.

@kwindla
Created April 29, 2021 05:41
Show Gist options
  • Save kwindla/b0555d0cb1998601695a711e828cfdc5 to your computer and use it in GitHub Desktop.
Save kwindla/b0555d0cb1998601695a711e828cfdc5 to your computer and use it in GitHub Desktop.
Daily video API -- setting simulcast layers for higher bitrates
<html>
<head>
<title>setting simulcast layers for higher bitrate</title>
<script src="https://unpkg.com/@daily-co/daily-js"></script>
</head>
<body onload="main()">
<script>
/*
This is sample code showing a simulcast layer configuration
with higher bitrates than the Daily defaults.
There is no UI code here. No pixels will be drawn in the
browser window!
Run this with the js console window open and join the room URL
directly, in another browser tab, to see the video being
sent.
*/
// change ROOM_URL to a room in your Daily domain
const ROOM_URL = 'https://x.daily.co/foo ... <-- REPLACE ME';
async function main() {
window.call = DailyIframe.createCallObject({
dailyConfig: {
experimentalChromeVideoMuteLightOff: true,
camSimulcastEncodings: [
{
maxBitrate: 220000,
maxFramerate: 20,
scaleResolutionDownBy: 4,
},
{
maxBitrate: 360000,
maxFramerate: 20,
scaleResolutionDownBy: 2,
},
{ maxBitrate: 1200000 },
],
},
});
call.on('error', (e) => console.error(e));
await call.join({ url: ROOM_URL });
await call.setNetworkTopology({ toplogy: 'sfu' });
}
function toggleLocalVideo() {
call.setShowLocalVideo(!call.showLocalVideo());
}
function toggleParticipantsBar() {
call.setShowParticipantsBar(!call.showParticipantsBar());
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment