Skip to content
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

Create AudioContext in HTML5 vendor on componentDidMount #53

Merged
merged 3 commits into from Dec 22, 2018

Conversation

danielr18
Copy link
Contributor

This way you can import Player in SSR projects again, otherwise it crashes because there's no window in server side.

@@ -3,12 +3,8 @@ import PropTypes from 'prop-types'
import { findDOMNode } from 'react-dom'
import vendorPropTypes from './vendor-prop-types'

const AudioContext = window.AudioContext || window.webkitAudioContext
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we only need to change this line. Something like:

const AudioContext = typeof window === 'undefined' ? false : (window.AudioContext || window.webkitAudioContext)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would work

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! If you get a chance and want to update this PR, I'll get it merged and released.

@souporserious
Copy link
Owner

Sorry, this took a little while to get to. I think we can fix this with one-liner hopefully 🤞. Please see my comment where context is created.

@danielr18
Copy link
Contributor Author

Made the change

@souporserious souporserious merged commit 89f61b4 into souporserious:master Dec 22, 2018
@souporserious
Copy link
Owner

Thank you!! 🙏 Released under 0.7.6 😇.

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.

None yet

2 participants