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

fix(html5): do not set ref when using audio object #43

Merged
merged 1 commit into from Nov 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/vendors/HTML5.jsx
Expand Up @@ -152,6 +152,16 @@ class HTML5 extends Component {
this._player = null
}

_setRef = c => {
// if we are using audio object, we've already set
// this._player in componentWillReceiveProps so we
// do not want to wipe it out with the `null` returned
// from render
if (this.props.extraProps.useAudioObject !== true) {
this._player = c
}
}

_bindAudioObjectEvents({ extraProps }) {
const playerEvents = this._playerEvents

Expand All @@ -170,7 +180,7 @@ class HTML5 extends Component {

if (!useAudioObject) {
return createElement(vendor, {
ref: c => (this._player = c),
ref: this._setRef,
src,
...extraProps,
...this._playerEvents,
Expand Down