Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

fix(Video): fix muted prop #1847

Merged
merged 2 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Fixes
- Fix `muted` prop in `Video` component @layershifter ([#1847](https://github.com/stardust-ui/react/pull/1847))

<!--------------------------------[ v0.37.0 ]------------------------------- -->
## [v0.37.0](https://github.com/stardust-ui/react/tree/v0.37.0) (2019-08-26)
[Compare changes](https://github.com/stardust-ui/react/compare/v0.36.2...v0.37.0)
Expand Down
6 changes: 1 addition & 5 deletions packages/react/src/components/Video/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ class Video extends UIComponent<WithAsProp<VideoProps>> {
// React doesn't guaranty that props will be set:
// https://github.com/facebook/react/issues/10389
if (this.videoRef.current) {
if (this.props.muted) {
this.videoRef.current.setAttribute('muted', 'true')
} else {
this.videoRef.current.removeAttribute('muted')
}
this.videoRef.current.muted = !!this.props.muted
Copy link
Member Author

@layershifter layershifter Aug 26, 2019

Choose a reason for hiding this comment

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

facebook/react#10389 (comment)

We should set muted directly, setAttribute only shows this attribute on DOM.

}
}

Expand Down