diff options
author | ThibG <thib@sitedethib.com> | 2020-04-25 12:16:05 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-04-25 15:28:16 +0200 |
commit | 572e89e56323e2f398ea5a168caf3d8b7e3e46b8 (patch) | |
tree | f28e5715912d2d7b318b61240fde3d07759210a1 /app/javascript/flavours/glitch/features/video | |
parent | 0f4a8a64877dfd2953e515043cefa87c1f031d14 (diff) |
[Glitch] Fix expanded video player issues
Port c955f98d36868e85b0f1939a3a1c58c00babd4e8 to glitch-soc Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/video')
-rw-r--r-- | app/javascript/flavours/glitch/features/video/index.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/video/index.js b/app/javascript/flavours/glitch/features/video/index.js index 6a8952c8d..a89d9c8b0 100644 --- a/app/javascript/flavours/glitch/features/video/index.js +++ b/app/javascript/flavours/glitch/features/video/index.js @@ -111,6 +111,8 @@ class Video extends React.PureComponent { preventPlayback: PropTypes.bool, blurhash: PropTypes.string, link: PropTypes.node, + autoPlay: PropTypes.bool, + defaultVolume: PropTypes.number, }; state = { @@ -360,6 +362,13 @@ class Video extends React.PureComponent { handleLoadedData = () => { if (this.props.startTime) { this.video.currentTime = this.props.startTime; + } + + if (this.props.defaultVolume !== undefined) { + this.video.volume = this.props.defaultVolume; + } + + if (this.props.autoPlay) { this.video.play(); } } @@ -386,8 +395,14 @@ class Video extends React.PureComponent { height, }); + const options = { + startTime: this.video.currentTime, + autoPlay: !this.state.paused, + defaultVolume: this.state.volume, + }; + this.video.pause(); - this.props.onOpenVideo(media, this.video.currentTime); + this.props.onOpenVideo(media, options); } handleCloseVideo = () => { |