Skip to content

Instantly share code, notes, and snippets.

@kwindla
Created March 1, 2023 02:24
Show Gist options
  • Save kwindla/c486b4b892f72e4a564449d66265393e to your computer and use it in GitHub Desktop.
Save kwindla/c486b4b892f72e4a564449d66265393e to your computer and use it in GitHub Desktop.
Music mode screensharing audio test
<html>
<head>
<title>test high bitrate audio-only screenshare</title>
<script src="https://unpkg.com/@daily-co/daily-js"></script>
</head>
<body onload="main()">
<div id="videos"></div>
<script>
async function main() {
const ROOM_URL = "A ROOM URL HERE";
window.callObject = DailyIframe.createCallObject({
dailyConfig: {
micAudioMode: 'music',
},
audioSource: false,
videoSource: false,
});
await callObject.join({ url: ROOM_URL });
await callObject.setNetworkTopology({ topology: "sfu" });
}
async function startAudioScreenShare() {
let stream = await navigator.mediaDevices.getDisplayMedia({
video: true,
audio: {
autoGainControl: false,
noiseSuppression: false,
echoCancellation: false,
},
});
let audioOnlyStream = new MediaStream([stream.getAudioTracks()[0]]);
callObject.startScreenShare({ mediaStream: audioOnlyStream });
}
</script>
<button onclick="startAudioScreenShare()">start screenshare</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment