about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/components/video_modal.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-04-25 12:16:05 +0200
committerGitHub <noreply@github.com>2020-04-25 12:16:05 +0200
commitc955f98d36868e85b0f1939a3a1c58c00babd4e8 (patch)
treeeffaf743cd9f3d552b8754694369bafdcb596e3d /app/javascript/mastodon/features/ui/components/video_modal.js
parent46b2cc184fab294f540b3cc1ffa3d9e6ac2c9fbf (diff)
Fix expanded video player issues (#13541)
Fixes #13536

- Expanding a paused video doesn't autoplay anymore
- Default volume level for the expanded video inherited from the original video

Position/playing state/volume are carried over from the original video player
to the modal, but they're not reported back to the modal as it would require
deeper changes.
Diffstat (limited to 'app/javascript/mastodon/features/ui/components/video_modal.js')
-rw-r--r--app/javascript/mastodon/features/ui/components/video_modal.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/ui/components/video_modal.js b/app/javascript/mastodon/features/ui/components/video_modal.js
index f37fc796f..e28bd5b49 100644
--- a/app/javascript/mastodon/features/ui/components/video_modal.js
+++ b/app/javascript/mastodon/features/ui/components/video_modal.js
@@ -14,7 +14,11 @@ export default class VideoModal extends ImmutablePureComponent {
   static propTypes = {
     media: ImmutablePropTypes.map.isRequired,
     status: ImmutablePropTypes.map,
-    time: PropTypes.number,
+    options: PropTypes.shape({
+      startTime: PropTypes.number,
+      autoPlay: PropTypes.bool,
+      defaultVolume: PropTypes.number,
+    }),
     onClose: PropTypes.func.isRequired,
   };
 
@@ -52,7 +56,8 @@ export default class VideoModal extends ImmutablePureComponent {
   }
 
   render () {
-    const { media, status, time, onClose } = this.props;
+    const { media, status, onClose } = this.props;
+    const options = this.props.options || {};
 
     return (
       <div className='modal-root__modal video-modal'>
@@ -61,7 +66,9 @@ export default class VideoModal extends ImmutablePureComponent {
             preview={media.get('preview_url')}
             blurhash={media.get('blurhash')}
             src={media.get('url')}
-            startTime={time}
+            startTime={options.startTime}
+            autoPlay={options.autoPlay}
+            defaultVolume={options.defaultVolume}
             onCloseVideo={onClose}
             detailed
             alt={media.get('description')}