Skip to content

Commit

Permalink
fix: remove obsolete type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguttandin committed Aug 29, 2023
1 parent 2e60010 commit e630e8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/factories/web-audio-media-recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,7 @@ export const createWebAudioMediaRecorderFactory: TWebAudioMediaRecorderFactoryFa
eventTarget.dispatchEvent(new Event('start'));

const audioTracks = mediaStream.getAudioTracks();
// @todo TypeScript v4.4.2 removed the channelCount property from the MediaTrackSettings interface.
const channelCount =
audioTracks.length === 0
? 2
: (<MediaTrackSettings & { channelCount?: number }>audioTracks[0].getSettings()).channelCount ?? 2;
const channelCount = audioTracks.length === 0 ? 2 : audioTracks[0].getSettings().channelCount ?? 2;

promisedAudioNodesAndEncoderId = Promise.all([
resume(),
Expand Down
4 changes: 1 addition & 3 deletions src/factories/webm-pcm-media-recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ export const createWebmPcmMediaRecorderFactory: TWebmPcmMediaRecorderFactoryFact

if (audioTrack !== undefined && nativeMediaRecorder.state === 'inactive') {
// Bug #19: Chrome does not expose the correct channelCount property right away.
// @todo TypeScript v4.4.2 removed the channelCount property from the MediaTrackSettings interface.
const channelCount = (<MediaTrackSettings & { channelCount?: number }>audioTrack.getSettings()).channelCount;
const sampleRate = audioTrack.getSettings().sampleRate;
const { channelCount, sampleRate } = audioTrack.getSettings();

if (channelCount === undefined) {
throw new Error('The channelCount is not defined.');
Expand Down

0 comments on commit e630e8a

Please sign in to comment.