after recording a tab, a tiddler called audio.mp3 is produced with type audio/mpeg changing the type to video/webm shows that video along with audio has been recorded (instead of just audio).
The problem was caused by navigator.mediaDevices.getDisplayMedia(), which requires a video track in order to capture window or tab content.
The solution is that after initializing the displayMedia audio AND video tracks, I now create a secondary stream that uses stream.getAudioTracks() to only capture the audio track without the video track.
Fortunately, I already had a function that I was using to selectively merge tracks when capturing both video/voice (getUserMedia) and screen/audio (getDisplayMedia) (i.e, “picture-in-picture” mode), and this function can also be used to create a stream that excludes the video track so it contains only the desired audio tracks.
Thus, the fix was only an additional 15 bytes, by changing this line of code: