Reputation: 2578
I am trying to use AudioContext to draw vector sound waves in react native. Used blow code to do so.
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const mediaStreamSource = audioContext.createMediaStreamSource(audioStream);
But, the audioContext variable is always undenifed. Couldn't get window.AudioContext or window.webkitAudioContext to work. Both returning undefined when used console.log.
It didn't worked because it is react native. Could anyone let me know what is the replacement of window.AudioContext || window.webkitAudioContext for react native application.
Thanks in Advance.
Upvotes: 0
Views: 549
Reputation: 11
According to my knowledge, AudioContext can't be used in react native since it is a web api. This could be the reason you get undefined for window.AudioContext and window.webkitAudioContext. :)
Upvotes: 1