Fix crash on screen share

Don't try to wire up audio nodes if the stream has no audio track,
'cos it'll crash.

Fixes https://github.com/vector-im/element-call/issues/421
This commit is contained in:
David Baker 2022-07-20 20:49:07 +01:00
parent 6d7f52d2d6
commit 56afbe6eb1

View File

@ -202,7 +202,12 @@ export const useSpatialMediaStream = (
const sourceRef = useRef<MediaStreamAudioSourceNode>();
useEffect(() => {
if (spatialAudio && tileRef.current && !mute) {
if (
spatialAudio &&
tileRef.current &&
!mute &&
stream.getAudioTracks().length > 0
) {
if (!pannerNodeRef.current) {
pannerNodeRef.current = new PannerNode(audioContext, {
panningModel: "HRTF",