@@ -136,6 +136,9 @@ class Video extends React.PureComponent {
136136
137137 setVideoRef = c => {
138138 this . video = c ;
139+ if ( this . video ) {
140+ this . setState ( { volume : this . video . volume , muted : this . video . muted } ) ;
141+ }
139142 }
140143
141144 setSeekRef = c => {
@@ -302,6 +305,10 @@ class Video extends React.PureComponent {
302305 }
303306 }
304307
308+ handleVolumeChange = ( ) => {
309+ this . setState ( { volume : this . video . volume , muted : this . video . muted } ) ;
310+ }
311+
305312 handleOpenVideo = ( ) => {
306313 const { src, preview, width, height, alt } = this . props ;
307314 const media = fromJS ( {
@@ -387,6 +394,7 @@ class Video extends React.PureComponent {
387394 onTimeUpdate = { this . handleTimeUpdate }
388395 onLoadedData = { this . handleLoadedData }
389396 onProgress = { this . handleProgress }
397+ onVolumeChange = { this . handleVolumeChange }
390398 />
391399
392400 < button type = 'button' className = { classNames ( 'video-player__spoiler' , { active : ! revealed } ) } onClick = { this . toggleReveal } >
@@ -409,7 +417,7 @@ class Video extends React.PureComponent {
409417 < div className = 'video-player__buttons-bar' >
410418 < div className = 'video-player__buttons left' >
411419 < button type = 'button' aria-label = { intl . formatMessage ( paused ? messages . play : messages . pause ) } onClick = { this . togglePlay } > < i className = { classNames ( 'fa fa-fw' , { 'fa-play' : paused , 'fa-pause' : ! paused } ) } /> </ button >
412- < button type = 'button' aria-label = { intl . formatMessage ( muted ? messages . unmute : messages . mute ) } onMouseEnter = { this . volumeSlider } onMouseLeave = { this . volumeSlider } onClick = { this . toggleMute } > < i className = { classNames ( 'fa fa-fw' , { 'fa-volume-off' : muted , 'fa-volume-up' : ! muted } ) } /> </ button >
420+ < button type = 'button' aria-label = { intl . formatMessage ( muted ? messages . unmute : messages . mute ) } onClick = { this . toggleMute } > < i className = { classNames ( 'fa fa-fw' , { 'fa-volume-off' : muted , 'fa-volume-up' : ! muted } ) } /> </ button >
413421 < div className = 'video-player__volume' onMouseDown = { this . handleVolumeMouseDown } ref = { this . setVolumeRef } >
414422 < div className = 'video-player__volume__current' style = { { width : `${ volumeWidth } px` } } />
415423 < span
0 commit comments