Problem with tiddlytools action-camera

@EricShulman using chrome, go to TiddlyTools for TW5 v5.3.3 — Small Tools for Big Ideas!™ and select ‘applcation sounds’

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).

1 Like

Good catch!

Fixed as of Thu, Apr 4th 2024, 11:34:01am (PDT).

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:

if(!video&&!voice) init(s1=vstream);

to this:

if(!video&&!voice) init(merge(s1=vstream,s2=null));

Get the updated widget here: TiddlyTools/Widgets/action-camera.js (revision 3.3)

enjoy,
-e

3 Likes