File tree 2 files changed +8
-6
lines changed
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ const startRecording = async () => {
49
49
50
50
endRecordingButton . style . display = 'block' ;
51
51
52
- let audioSampleRate = audioTrack ?. getCapabilities ( ) . sampleRate . max ;
52
+ let audioSampleRate = audioTrack ?. getSettings ( ) . sampleRate ;
53
+ let audioNumberOfChannels = audioTrack ?. getSettings ( ) . channelCount ;
53
54
54
55
// Create an MP4 muxer with a video track and maybe an audio track
55
56
muxer = new Mp4Muxer . Muxer ( {
@@ -66,7 +67,7 @@ const startRecording = async () => {
66
67
audio : audioTrack ? {
67
68
codec : 'aac' ,
68
69
sampleRate : audioSampleRate ,
69
- numberOfChannels : 1
70
+ numberOfChannels : audioNumberOfChannels
70
71
} : undefined ,
71
72
72
73
// Puts metadata to the start of the file. Since we're using ArrayBufferTarget anyway, this makes no difference
@@ -95,7 +96,7 @@ const startRecording = async () => {
95
96
} ) ;
96
97
audioEncoder . configure ( {
97
98
codec : 'mp4a.40.2' ,
98
- numberOfChannels : 1 ,
99
+ numberOfChannels : audioNumberOfChannels ,
99
100
sampleRate : audioSampleRate ,
100
101
bitrate : 128000
101
102
} ) ;
Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ const startRecording = async () => {
40
40
41
41
endRecordingButton . style . display = 'block' ;
42
42
43
- let audioSampleRate = audioTrack ?. getCapabilities ( ) . sampleRate . max ;
43
+ let audioSampleRate = audioTrack ?. getSettings ( ) . sampleRate ;
44
+ let audioNumberOfChannels = audioTrack ?. getSettings ( ) . channelCount ;
44
45
45
46
// Create an MP4 muxer with a video track and maybe an audio track
46
47
muxer = new Mp4Muxer . Muxer ( {
@@ -55,7 +56,7 @@ const startRecording = async () => {
55
56
audio : audioTrack ? {
56
57
codec : 'aac' ,
57
58
sampleRate : audioSampleRate ,
58
- numberOfChannels : 1
59
+ numberOfChannels : audioNumberOfChannels
59
60
} : undefined ,
60
61
61
62
// Puts metadata to the start of the file. Since we're using ArrayBufferTarget anyway, this makes no difference
@@ -84,7 +85,7 @@ const startRecording = async () => {
84
85
} ) ;
85
86
audioEncoder . configure ( {
86
87
codec : 'mp4a.40.2' ,
87
- numberOfChannels : 1 ,
88
+ numberOfChannels : audioNumberOfChannels ,
88
89
sampleRate : audioSampleRate ,
89
90
bitrate : 128000
90
91
} ) ;
You can’t perform that action at this time.
0 commit comments