From: Thibaut Girka Date: Sun, 27 Jan 2019 21:02:59 +0000 (+0100) Subject: [Glitch] Fix initial value of volume slider in video player and handle volume changes X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=f35d79048006ea733b84719b4c24aaeb1655aa0b;p=mastodon.git [Glitch] Fix initial value of volume slider in video player and handle volume changes Port a53dcaa29869e808707efcba541b02ee8d799e75 to glitch-soc --- diff --git a/app/javascript/flavours/glitch/features/video/index.js b/app/javascript/flavours/glitch/features/video/index.js index 30592707c..d8e8791a7 100644 --- a/app/javascript/flavours/glitch/features/video/index.js +++ b/app/javascript/flavours/glitch/features/video/index.js @@ -139,6 +139,9 @@ export default class Video extends React.PureComponent { setVideoRef = c => { this.video = c; + if (this.video) { + this.setState({ volume: this.video.volume, muted: this.video.muted }); + } } setSeekRef = c => { @@ -319,6 +322,10 @@ export default class Video extends React.PureComponent { } } + handleVolumeChange = () => { + this.setState({ volume: this.video.volume, muted: this.video.muted }); + } + handleOpenVideo = () => { const { src, preview, width, height, alt } = this.props; const media = fromJS({ @@ -407,6 +414,7 @@ export default class Video extends React.PureComponent { onTimeUpdate={this.handleTimeUpdate} onLoadedData={this.handleLoadedData} onProgress={this.handleProgress} + onVolumeChange={this.handleVolumeChange} /> - +