MediaStreamAPI: Difference between revisions

Line 150: Line 150:
'inputParams' provides access to structured clones of the latest parameters set for each input stream.
'inputParams' provides access to structured clones of the latest parameters set for each input stream.


'audioSampleRate' and 'audioChannelCount' represent the format of the samples. The sample buffers for all input streams are automatically converted to a common format by the UA, typically the highest-fidelity format (to avoid lossy conversion). 'audioInputs' gives access to the audio samples for each input stream. The length of each sample buffer will be a multiple of 'audioChannelCount'. The samples are floats ranging from -1 to 1. The lengths of the sample buffers will be equal.
'audioSampleRate' and 'audioChannelCount' represent the format of the samples. The sample buffers for all input streams are automatically converted to a common format by the UA, typically the highest-fidelity format (to avoid lossy conversion). 'audioInputs' gives access to the audio samples for each input stream. The length of each sample buffer will be a multiple of 'audioChannelCount'. The samples are floats ranging from -1 to 1. The lengths of the sample buffers will be equal. Streams with no audio produce a buffer containing silence.


'writeAudio' writes audio data to the stream output. If 'writeAudio' is not called before the event handler returns, the inputs are automatically mixed and written to the output. The format of the output is the same as the inputs; the 'data' array length must be a multiple of audioChannelCount. 'writeAudio' can be called more than once during an event handler; the data will be appended to the output stream.
'writeAudio' writes audio data to the stream output. If 'writeAudio' is not called before the event handler returns, the inputs are automatically mixed and written to the output. The format of the output is the same as the inputs; the 'data' array length must be a multiple of audioChannelCount. 'writeAudio' can be called more than once during an event handler; the data will be appended to the output stream.
1,295

edits