Skip to content

Commit

Permalink
fix: mobile muted (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyuhen authored May 26, 2020
1 parent 812fefb commit fa3a8fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
1 change: 0 additions & 1 deletion packages/griffith/src/components/Player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ class Player extends Component {
onPlaying={this.handleVideoPlaying}
onSeeking={this.handleVideoSeeking}
onSeeked={this.handleVideoSeeked}
onVolumeChange={this.handleVideoVolumeChange}
onProgress={this.handleVideoProgress}
onEvent={onEvent}
useMSE={useMSE}
Expand Down
11 changes: 1 addition & 10 deletions packages/griffith/src/components/Video/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Video extends Component {
onPlaying: PropTypes.func,
onSeeking: PropTypes.func,
onSeeked: PropTypes.func,
onVolumeChange: PropTypes.func,
onProgress: PropTypes.func,
onError: PropTypes.func.isRequired,
onEvent: PropTypes.func.isRequired,
Expand Down Expand Up @@ -92,7 +91,7 @@ class Video extends Component {
}
}

if (this.root.volume !== volume ** 2) {
if (this.root.volume !== volume ** 2 && !isMobile) {
this.root.volume = volume ** 2
}
}
Expand Down Expand Up @@ -234,13 +233,6 @@ class Video extends Component {
}
}

handleVolumeChange = () => {
const {onVolumeChange} = this.props
if (onVolumeChange) {
onVolumeChange(this.root.muted ? 0 : Math.sqrt(this.root.volume))
}
}

handleProgress = () => {
const {onProgress} = this.props
const buffered = this.root.buffered
Expand Down Expand Up @@ -321,7 +313,6 @@ class Video extends Component {
onError={this.handleError}
onDurationChange={this.handleDurationChange}
onTimeUpdate={this.handleTimeUpdate}
onVolumeChange={this.handleVolumeChange}
onProgress={this.handleProgress}
onWaiting={this.handleWaiting}
onPlaying={this.handlePlaying}
Expand Down

0 comments on commit fa3a8fd

Please sign in to comment.