The onShareComputerAudio API works when plain audio is shared, and when audio is shared with screen share, or video played.
However, the detection of the ending of audio is ONLY reported for sharing of Audio as a separate feature. (including the end of playing of audio from the music app}
When a screen share with audio, or a video played with audio is ended, there is not call seen to the function.
The audioevent also does not see the source method of the audio, just the participant sharing. So it has no way to know how the audio was shared.
function onShareComputerAudio() {
const outputDiv = document.getElementById('audioStatus');
outputDiv.textContent = "🎧 Listening for computer audio sharing events...\n";
zoomSdk.addEventListener("onShareComputerAudio", (event) => {
console.log(event);
const { action, participantUUID, timestamp } = event;
const readableTime = new Date(timestamp * 1000).toLocaleString();
const message = `
🔔 Audio Sharing Event:
• Action: ${action === "start" ? "🟢 Started" : "🔴 Stopped"}
• Participant UUID: ${participantUUID}
• Time: ${readableTime}
---------------------------
`;
console.log("🔊 onShareComputerAudio event received:", event);
outputDiv.textContent = message + outputDiv.textContent;
});
}
</script>
this code would need config = await zoomSdk.config run in advance.
This was test on windows laptop : clientVersion “6.4.6.64360”
SDK version: ‘0.16.28’
All the best
John Drinkwater