|
hasVideo: archiveOptions.hasVideo ? archiveOptions.hasVideo : true, |
Issue Description
π Bug Summary
The addArchiveStream function incorrectly ignores explicit false values passed for hasAudio or hasVideo.
When { hasVideo: false } or { hasAudio: false } is provided, the function treats the value as falsy and defaults to true, resulting in unwanted audio/video being added to the archive.
π‘ Expected Behavior
If a caller explicitly passes false for either option, that value should be respected.
βοΈ Current Behavior
hasAudio: archiveOptions.hasAudio ? archiveOptions.hasAudio : true,
hasVideo: archiveOptions.hasVideo ? archiveOptions.hasVideo : true,
Because of the truthy check, any falsy value (including false) triggers the default true.
β
Proposed Fix
Replace the truthy checks with nullish coalescing (??) to only default when the option is undefined or null:
hasAudio: archiveOptions.hasAudio ?? true,
hasVideo: archiveOptions.hasVideo ?? true,
π Impact
- Developers cannot currently disable audio or video streams when adding to an archive.
- Causes incorrect archive configuration and potential unnecessary media inclusion.
π§© Affected Module
archive.js β addArchiveStream()
opentok-node/lib/archiving.js
Line 427 in 18aa507
Issue Description
π Bug Summary
The
addArchiveStreamfunction incorrectly ignores explicitfalsevalues passed forhasAudioorhasVideo.When
{ hasVideo: false }or{ hasAudio: false }is provided, the function treats the value as falsy and defaults totrue, resulting in unwanted audio/video being added to the archive.π‘ Expected Behavior
If a caller explicitly passes
falsefor either option, that value should be respected.βοΈ Current Behavior
Because of the truthy check, any falsy value (including
false) triggers the defaulttrue.β Proposed Fix
Replace the truthy checks with nullish coalescing (
??) to only default when the option isundefinedornull:π Impact
π§© Affected Module
archive.jsβaddArchiveStream()