-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: Cannot read property 'AudioContext' of undefined #65
Comments
Hi @danielhusar, this sounds like an error in your code related to how your using web audio not the soundcloud api. I have an example (here) using tone.js which may help you. Can you share your code? |
Unfortunately, I had the same error with the same versions of webpack and babel. It breaks immediately on import, but my app works totally fine with a manual HTML reference to Soundcloud's CDN. |
I'm having this same problem too, it happens on the first method call: I don't know why this wouldn't work but it doesn't.
import SC from 'soundcloud';
import EVENTS from '../Events';
let track = `/tracks/${window.location.search.substr(1)}`;
const SOUNDCLOUD_STATES = {
'playing': EVENTS.PLAYING,
'paused': EVENTS.PAUSED,
'loading': EVENTS.LOADING,
'ended': EVENTS.COMPLETE,
'error': EVENTS.ERROR
};
SC.stream(track).then(function(player){
player.play();
player.on('state-change', event => {
window.postMessageNative(SOUNDCLOUD_STATES[event], '*');
});
document.addEventListener('message', window.listener = function(event) {
let data = JSON.parse(event.data);
switch (data.type) {
case EVENTS.PLAY:
player.play();
break;
case EVENTS.PAUSE:
player.pause();
break;
case EVENTS.VOLUME:
player.setVolume(.5);
break;
}
});
}); |
Likewise |
I'm getting this issue when installing sdk from npm and using it with webpack and babel.
(webpack
^1.12.12
, babel:^6.2.1
)The text was updated successfully, but these errors were encountered: