Skip to content

Update config.js#374

Merged
danpastori merged 1 commit intoserversideup:masterfrom
klh:patch-1
May 29, 2020
Merged

Update config.js#374
danpastori merged 1 commit intoserversideup:masterfrom
klh:patch-1

Conversation

@klh
Copy link
Copy Markdown
Contributor

@klh klh commented Aug 9, 2019

don't initialize window.Audio as part of an automatic setup, it will Barf in packagers such as webpack et.all.
instead make it part of the init call - like so:

 Amplitude.init({
      audio: new Audio(),
      bindings: {
        37: 'prev',
        39: 'next',
        32: 'play_pause',
      })

or alternatively wrap it in a conditional if(window && window.Audio)

don't initialize window.Audio as part of an automatic setup, it will Barf in packager such as webpack, rollbar etc.
instead make it part of the init call - like so:
```
 Amplitude.init({
      audio: new Audio(),
      bindings: {
        37: 'prev',
        39: 'next',
        32: 'play_pause',
      })
```

or alternatively wrap it in a conditional ```if(window && window.Audio)```
@danpastori danpastori merged commit 7cabc0e into serversideup:master May 29, 2020
@danpastori
Copy link
Copy Markdown
Contributor

Thank you for submitting your PR! I'll make the change to initialize the audio on init.

@danpastori
Copy link
Copy Markdown
Contributor

With the last PR of #420 , we can set this to null and the audio will get initialized through the changeSong method. This is convenient since we change the song to be the initialized song.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants