Skip to content

Commit 166c8f4

Browse files
committed
fix file extension mapping
1 parent 9ecfb84 commit 166c8f4

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

src/app/plugins/voice-recorder-kit/supportedCodec.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,18 @@ export function getSupportedAudioCodec(): string | null {
6060
* This is used to ensure that the recorded audio file has the correct extension based on the codec used for recording.
6161
*/
6262
export function getSupportedAudioExtension(codec: string): string {
63-
switch (codec) {
64-
case 'audio/ogg;codecs=opus':
65-
case 'audio/ogg;codecs=vorbis':
66-
case 'audio/ogg;codecs=speex':
63+
const baseType = codec.split(';')[0].trim();
64+
switch (baseType) {
6765
case 'audio/ogg':
6866
return 'ogg';
69-
case 'audio/webm;codecs=opus':
7067
case 'audio/webm':
7168
return 'webm';
7269
case 'audio/mp4':
73-
case 'audio/mp4;codecs=aac':
7470
return 'm4a';
7571
case 'audio/mpeg':
7672
return 'mp3';
77-
case 'audio/wav;codecs=1':
7873
case 'audio/wav':
7974
return 'wav';
80-
// silly webkit stuff
81-
case 'audio/mp4;codecs=mp4a.40.2':
82-
case 'audio/mp4;codecs=mp4a.40.5':
83-
return 'm4a';
8475
case 'audio/aac':
8576
return 'aac';
8677
default:

0 commit comments

Comments
 (0)