Search completed in 0.96 seconds.
AudioContextOptions.sampleRate - Web APIs
the audiocontextoptions dictionary (used when instantiating an audiocontext) may contain a property named
samplerate, which indicates the sample rate to use for the new context.
... the value must be a floating-point value indicating the sample rate, in samples per second, for which to configure the new context; additionally, the value must be one which is supported by audiobuffer.
samplerate.
... syntax audiocontextoptions.
samplerate = 44100; var
samplerate = audiocontextoptions.
samplerate; value the desired sample rate for the audiocontext, specified in samples per second.
...And 3 more matches
MediaTrackSettings.sampleRate - Web APIs
the mediatracksettings dictionary's
samplerate property is an integer indicating how many audio samples per second the mediastreamtrack is currently configured for.
... this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.
samplerate property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
... if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.
samplerate as returned by a call to mediadevices.getsupportedconstraints().
...And 2 more matches
AudioBuffer.sampleRate - Web APIs
the
samplerate property of the audiobuffer interface returns a float representing the sample rate, in samples per second, of the pcm data stored in the buffer.
... syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); myarraybuffer.
samplerate; value a floating-point value indicating the current sample rate of the buffers data, in samples per second.
... example // stereo var channels = 2; // create an empty two second stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.
samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); button.onclick = function() { // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } console.log(myarraybuffer.
samplerate); } specification specificati...
...on status comment web audio apithe definition of '
samplerate' in that specification.
BaseAudioContext.sampleRate - Web APIs
the
samplerate property of the baseaudiocontext interface returns a floating point number representing the sample rate, in samples per second, used by all nodes in this audio context.
... syntax baseaudiocontext.
samplerate; value a floating point number indicating the audio context's sample rate, in samples per second.
...try entering audioctx.
samplerate into your browser console.
... console.log(audioctx.
samplerate); specifications specification status comment web audio apithe definition of '
samplerate' in that specification.
MediaTrackConstraints.sampleRate - Web APIs
the mediatrackconstraints dictionary's
samplerate property is a constrainlong describing the requested or mandatory constraints placed upon the value of the
samplerate constrainable property.
... if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.
samplerate as returned by a call to mediadevices.getsupportedconstraints().
... syntax var constraintsobject = {
samplerate: constraint }; constraintsobject.
samplerate = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified.
... specifications specification status comment media capture and streamsthe definition of '
samplerate' in that specification.
MediaTrackSupportedConstraints.sampleRate - Web APIs
the mediatracksupportedconstraints dictionary's
samplerate property is a read-only boolean value which is present (and set to true) in the object returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the
samplerate constraint.
... syntax
samplerateconstraintsupported = supportedconstraintsdictionary.
samplerate; value this property is present in the dictionary (and its value is always true) if the user agent supports the
samplerate constraint.
... example html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().
samplerate) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specifications specification status comment media capture and streamsthe definition of '
samplerate' in that specification.
Index - Web APIs
111 audiobuffer.
samplerate api, audiobuffer, property, reference, web audio api,
samplerate a floating-point value indicating the current sample rate of the buffers data, in samples per second.
... 137 audiocontextoptions api, audio, audiocontext, audiocontextoptions, configuration, context, dictionary, interface, options, reference, settings, web audio api,
samplerate the audiocontextoptions dictionary is used to specify configuration options when constructing a new audiocontext object to represent a graph of web audio nodes.
... 139 audiocontextoptions.
samplerate api, audio, audiocontext, audiocontextoptions, dictionary, interface, media, options, reference, sample rate, web audio, web audio api,
samplerate the audiocontextoptions dictionary (used when instantiating an audiocontext) may contain a property named
samplerate, which indicates the sample rate to use for the new context.
...And 5 more matches
Introducing the Audio API extension - Archive of obsolete content
this event has the following attributes: mozchannels: number of channels moz
samplerate: sample rate per second mozframebufferlength: number of samples collected in all channels this information is needed later to decode the audio data stream.
...tracts the data from an audio element: <!doctype html> <html> <head> <title>javascript metadata example</title> </head> <body> <audio id="audio-element" src="song.ogg" controls="true" style="width: 512px;"> </audio> <script> function loadedmetadata() { channels = audio.mozchannels; rate = audio.moz
samplerate; framebufferlength = audio.mozframebufferlength; } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('loadedmetadata', loadedmetadata, false); </script> </body> </html> the mozaudioavailable event as the audio is played, sample data is made available to the audio layer and the audio buffer (size defined in mozframebufferlength) gets f...
...ent: <!doctype html> <html> <head> <title>javascript visualization example</title> </head> <body> <audio id="audio-element" src="revolve.ogg" controls="true" style="width: 512px;"> </audio> <pre id="raw">hello</pre> <script> function loadedmetadata() { channels = audio.mozchannels; rate = audio.moz
samplerate; framebufferlength = audio.mozframebufferlength; } function audioavailable(event) { var framebuffer = event.framebuffer; var t = event.time; var text = "samples at: " + t + "\n"; text += framebuffer[0] + " " + framebuffer[1]; raw.innerhtml = text; } var raw = document.getelementbyid('raw'); var audio = document...
...And 3 more matches
BaseAudioContext.createBuffer() - Web APIs
syntax var buffer = baseaudiocontext.createbuffer(numofchannels, length,
samplerate); parameters note: for an in-depth explanation of how audio buffers work, and what these parameters mean, read audio buffers: frames, samples and channels from our basic concepts guide.
...to determine the length to use for a specific number of seconds of audio, use numseconds *
samplerate.
...
samplerate the sample rate of the linear audio data in sample-frames per second.
...And 2 more matches
OfflineAudioContext.OfflineAudioContext() - Web APIs
syntax var offlineaudioctx = new offlineaudiocontext(numberofchannels, length,
samplerate); var offlineaudioctx = new offlineaudiocontext(options); parameters you can specify the parameters for the offlineaudiocontext() constructor as either the same set of parameters as are inputs into the audiocontext.createbuffer() method, or by passing those parameters in an options object.
...for example, a 5-second buffer with a
samplerate of 48000hz would have a length of 5 * 48000 = 240000 sample-frames.
...
samplerate the sample-rate of the linear audio data in sample-frames per second.
... example const offlinectx = new offlineaudiocontext({ numberofchannels: 2, length: 44100 * 40,
samplerate: 44100, }); const source = offlinectx.createbuffersource(); // etc...
Creating a Web based tone generator - Archive of obsolete content
<!doctype html> <html> <head> <title>javascript audio write example</title> </head> <body> <input type="text" size="4" id="freq" value="440"><label for="hz">hz</label> <button onclick="start()">play</button> <button onclick="stop()">stop</button> <script type="text/javascript"> function audiodatadestination(
samplerate, readfn) { // initialize the audio output.
... var audio = new audio(); audio.mozsetup(1,
samplerate); var currentwriteposition = 0; var prebuffersize =
samplerate / 2; // buffer 500ms var tail = null; // the function called with regular interval to populate // the audio output buffer.
... var frequency = 0, currentsoundsample; var
samplerate = 44100; function requestsounddata(sounddata) { if (!frequency) { return; // no sound selected } var k = 2* math.pi * frequency /
samplerate; for (var i=0, size=sounddata.length; i<size; i++) { sounddata[i] = math.sin(k * currentsoundsample++); } } var audiodestination = new audiodatadestination(
samplerate, requestso...
AudioBuffer() - Web APIs
to determine the length to use for a specific number of seconds of audio, use numseconds *
samplerate.
...
samplerate: the sample rate in hz for the buffer.
... exceptions notsupportederror one or more of the options are negative or otherwise has an invalid value (such as numberofchannels being higher than supported, or a
samplerate outside the nominal range).
AudioContext() - Web APIs
samplerate optional the
samplerate to be used by the audiocontext, specified in samples per second.
... exceptions notsupportederror the specified
samplerate isn't supported by the context.
... var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext({ latencyhint: 'interactive',
samplerate: 44100, }); specifications specification status comment web audio apithe definition of 'audiocontext()' in that specification.
Visualizing an audio spectrum - Archive of obsolete content
idth: 512px;"> </audio> <div><canvas id="fft" width="512" height="200"></canvas></div> <script> var canvas = document.getelementbyid('fft'), ctx = canvas.getcontext('2d'), channels, rate, framebufferlength, fft; function loadedmetadata() { channels = audio.mozchannels; rate = audio.moz
samplerate; framebufferlength = audio.mozframebufferlength; fft = new fft(framebufferlength / channels, rate); } function audioavailable(event) { var fb = event.framebuffer, t = event.time, /* unused, but it's there */ signal = new float32array(fb.length / channels), magnitude; for (var i = 0, fbl = framebufferlength / 2; i ...
...aw rectangle bars for each frequency bin ctx.fillrect(i * 4, canvas.height, 3, -magnitude); } } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('mozaudioavailable', audioavailable, false); audio.addeventlistener('loadedmetadata', loadedmetadata, false); // fft from dsp.js, see below var fft = function(buffersize,
samplerate) { this.buffersize = buffersize; this.
samplerate =
samplerate; this.spectrum = new float32array(buffersize/2); this.real = new float32array(buffersize); this.imag = new float32array(buffersize); this.reversetable = new uint32array(buffersize); this.sintable = new float32array(buffersize); this.costable ...
AudioBuffer.duration - Web APIs
syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); myarraybuffer.duration; value a double.
... example // stereo var channels = 2; // create an empty two second stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.
samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); button.onclick = function() { // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } console.log(myarraybuffer.duration); } specification specificatio...
AudioBuffer.getChannelData() - Web APIs
syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); var nowbuffering = myarraybuffer.getchanneldata(channel); parameters channel the channel property is an index representing the particular channel to get data for.
... var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var button = document.queryselector('button'); var pre = document.queryselector('pre'); var myscript = document.queryselector('script'); pre.innerhtml = myscript.innerhtml; // stereo var channels = 2; // create an empty two second stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.
samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); button.onclick = function() { // fill the buffer with white noise; //just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i ...
AudioBuffer.length - Web APIs
syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); myarraybuffer.length; value an integer.
... example // stereo var channels = 2; // create an empty two second stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.
samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); button.onclick = function() { // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } console.log(myarraybuffer.length); } specification specification ...
AudioBuffer.numberOfChannels - Web APIs
syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); myarraybuffer.numberofchannels; value an integer.
... example // stereo var channels = 2; // create an empty two second stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.
samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); button.onclick = function() { // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } console.log(myarraybuffer.numberofchannels); } specification speci...
AudioBuffer - Web APIs
properties audiobuffer.
samplerate read only returns a float representing the sample rate, in samples per second, of the pcm data stored in the buffer.
... var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create an empty three-second stereo buffer at the sample rate of the audiocontext var myarraybuffer = audioctx.createbuffer(2, audioctx.
samplerate * 3, audioctx.
samplerate); // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < myarraybuffer.numberofchannels; channel++) { // this gives us the actual array that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < myarraybuffer.length; i++) { // math.random() is in [0; 1.0] // a...
AudioConfiguration - Web APIs
samplerate: the number of audio samples making up one second of the audio file.
... examples //create media configuration to be tested const mediaconfig = { type : 'file', // 'record', 'transmission', or 'media-source' audio : { contenttype : "audio/ogg", // valid content type channels : 2, // audio channels used by the track bitrate : 132700, // number of bits used to encode 1s of audio
samplerate : 5200 // number of audio samples making up that 1s.
AudioContextOptions - Web APIs
samplerate optional the
samplerate to be used by the audiocontext, specified in samples per second.
... let musiccontext = new audiocontext({ latencyhint: "playback",
samplerate: 48000 }); specifications specification status comment web audio apithe definition of 'audiocontextoptions' in that specification.
AudioWorkletGlobalScope - Web APIs
samplerate read only returns a float that represents the sample rate of the associated baseaudiocontext.
... console.log(currentframe) console.log(currenttime) } // the process method is required - simply output silence, // which the outputs are already filled with process (inputs, outputs, parameters) { return true } } // the sample rate is not going to change ever, // because it's a read-only property of a baseaudiocontext // and is set only during its instantiation console.log(
samplerate) // you can declare any variables and use them in your processors // for example it may be an arraybuffer with a wavetable const usefulvariable = 42 console.log(usefulvariable) registerprocessor('test-processor', testprocessor) next, in our main scripts file we'll load the processor, create an instance of audioworkletnode — passing the name of the processor to it — and connect the node to...
BiquadFilterNode.getFrequencyResponse() - Web APIs
for any frequency in frequencyarray whose value is outside the range 0.0 to
samplerate/2 (where
samplerate is the sample rate of the audiocontext), the corresponding value in this array is nan.
...for any frequency in frequencyarray whose value is outside the range 0.0 to
samplerate/2 (where
samplerate is the sample rate of the audiocontext), the corresponding value in this array is nan.
MediaConfiguration - Web APIs
samplerate: number of audio samples making up one second of the audio file.
... } }; const audioencoderconfig = { type : 'file', // 'record', 'transmission', or 'media-source' audio : { contenttype : "audio/ogg", // valid content type channels : 2, // audio channels used by the track bitrate : 132700, // number of bits used to encode 1s of audio
samplerate : 5200 // number of audio samples making up that 1s.
Advanced techniques: Creating and sequencing audio - Web APIs
we can use the baseaudiocontext.
samplerate property for this: const buffersize = audioctx.
samplerate * noiselength; const buffer = audioctx.createbuffer(1, buffersize, audioctx.
samplerate); now we can fill it with random numbers between -1 and 1: let data = buffer.getchanneldata(0); // get data // fill the buffer with noise for (let i = 0; i < buffersize; i++) { data[i] = math.random() * 2 - 1; } note: why -1 to 1?
...; durcontrol.addeventlistener('input', function() { noiseduration = number(this.value); }, false); let bandhz = 1000; const bandcontrol = document.queryselector('#band'); bandcontrol.addeventlistener('input', function() { bandhz = number(this.value); }, false); the final playnoise() function here's the entire playnoise() function: function playnoise() { const buffersize = audioctx.
samplerate * noiseduration; // set the time of the note const buffer = audioctx.createbuffer(1, buffersize, audioctx.
samplerate); // create an empty buffer let data = buffer.getchanneldata(0); // get data // fill the buffer with noise for (let i = 0; i < buffersize; i++) { data[i] = math.random() * 2 - 1; } // create a buffer source for our created data let noise = audi...
Displaying a graphic with audio samples - Archive of obsolete content
ight="200"></canvas></div> <img id="mozlogo" style="display:none" src="mozilla2.png"></img> <script> var canvas = document.getelementbyid('fft'), ctx = canvas.getcontext('2d'), channels, rate, framebufferlength, fft; function loadedmetadata() { channels = audio.mozchannels; rate = audio.moz
samplerate; framebufferlength = audio.mozframebufferlength; fft = new fft(framebufferlength / channels, rate); } function audioavailable(event) { var fb = event.framebuffer, t = event.time, /* unused, but it's there */ signal = new float32array(fb.length / channels), magnitude; for (var i = 0, fbl = framebufferlength...
nsIDOMMozNetworkStatsManager
est getallalarms([optional] in nsisupports network); nsidomdomrequest removealarms([optional] in long alarmid); nsidomdomrequest clearstats(in nsisupports network); nsidomdomrequest clearallstats(); nsidomdomrequest getavailablenetworks(); nsidomdomrequest getavailableservicetypes(); attributes attribute type description
samplerate long minimum time in milliseconds between samples stored in the database.
AudioBuffer.copyFromChannel() - Web APIs
var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); var anotherarray = new float32array(length); myarraybuffer.copyfromchannel(anotherarray, 1, 0); specification specification status comment web audio apithe definition of 'copyfromchannel' in that specification.
AudioBuffer.copyToChannel() - Web APIs
example var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); var anotherarray = new float32array; // copy channel data from second channel of myarraybuffer.
AudioBufferSourceNode.buffer - Web APIs
var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); button.onclick = function() { // fill the buffer with white noise; //just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs ...
AudioBufferSourceNode.detune - Web APIs
example const audioctx = new audiocontext(); const channelcount = 2; const framecount = audioctx.
samplerate * 2.0; // 2 seconds const myarraybuffer = audioctx.createbuffer(channelcount, framecount, audioctx.
samplerate); for (let channel = 0; channel < channelcount; channel++) { const nowbuffering = myarraybuffer.getchanneldata(channel); for (let i = 0; i < framecount; i++) { nowbuffering[i] = math.random() * 2 - 1; } } const source = audioctx.createbuffersource(); source.buffer = myarraybu...
AudioBufferSourceNode - Web APIs
var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create an empty three-second stereo buffer at the sample rate of the audiocontext var myarraybuffer = audioctx.createbuffer(2, audioctx.
samplerate * 3, audioctx.
samplerate); // fill the buffer with white noise; //just random values between -1.0 and 1.0 for (var channel = 0; channel < myarraybuffer.numberofchannels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < myarraybuffer.length; i++) { // math.random() is in [0; 1.0] ...
BaseAudioContext.createBufferSource() - Web APIs
var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var button = document.queryselector('button'); var pre = document.queryselector('pre'); var myscript = document.queryselector('script'); pre.innerhtml = myscript.innerhtml; // stereo var channels = 2; // create an empty two second stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.
samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.
samplerate); button.onclick = function() { // fill the buffer with white noise; //just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i ...
BaseAudioContext - Web APIs
baseaudiocontext.
samplerate read only returns a float representing the sample rate (in samples per second) used by all nodes in this context.
HTMLMediaElement - Web APIs
htmlmediaelement.moz
samplerate read only returns a double representing the number of samples per second that will be played.
MediaCapabilities.decodingInfo() - Web APIs
example //create media configuration to be tested const mediaconfig = { type : 'file', // or 'media-source' audio : { contenttype : "audio/ogg", // valid content type channels : 2, // audio channels used by the track bitrate : 132700, // number of bits used to encode 1s of audio
samplerate : 5200 // number of audio samples making up that 1s.
MediaCapabilitiesInfo - Web APIs
example // mediaconfiguration to be tested const mediaconfig = { type : 'file', audio : { contenttype : "audio/ogg", channels : 2, bitrate : 132700,
samplerate : 5200 }, }; // check support and performance navigator.mediacapabilities.decodinginfo(mediaconfig).then(result => { // result contains the media capabilities information console.log('this configuration is ' + (result.supported ?
MediaDevices.ondevicechange - Web APIs
let videoelement = document.getelementbyid("video"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ video: { width: 160, height: 120, framerate: 30 }, audio: {
samplerate: 44100, samplesize: 16, volume: 0.25 } }).then(stream => { videoelement.srcobject = stream; updatedevicelist(); }) .catch(err => log(err.name + ": " + err.message)); }, false); we set up global variables that contain references to the <ul> elements that are used to list the audio and video devices: let audiolist = document.getelementbyid("audiolist"); let ...
MediaTrackSettings - Web APIs
samplerate a long integer value indicating the current value of the
samplerate property, specifying the sample rate in samples per second of the audio data.
Using the Media Capabilities API - Web APIs
erate: 15 } }; had we been querying the decodability of an audio file, we would create an audio configuration including the number of channels and sample rate, leaving out the properties that apply only to video—namely, the dimensions and the frame rate: const audioconfiguration = { type: "file", audio: { contenttype: "audio/ogg", channels: 2, bitrate: 132700,
samplerate: 5200 } }; had we been testing encoding capabilities, we would have created a mediaencodingconfiguration, which requires the type of media being tested — either record (for recording media, i.e.
Media Capabilities API - Web APIs
if ('mediacapabilities' in navigator) { const audiofileconfiguration = { type : 'file', audio : { contenttype: "audio/mp3", channels: 2, bitrate: 132700,
samplerate: 5200 } }; navigator.mediacapabilities.decodinginfo(audiofileconfiguration).then(result => { console.log('this configuration is ' + (result.supported ?