about summary refs log tree commit diff
path: root/app/assets
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-17 18:05:02 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-17 18:05:02 +0200
commit5342629a0a6c58532b48a2669d4aca9fdce35170 (patch)
tree0a1f6fbae5d21b23b5da2b457754f848a38c51a0 /app/assets
parentbd5ad304bac69b34a3c223e9baac532106db7dd8 (diff)
Adding webm playback to UI
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/components/components/status.jsx7
-rw-r--r--app/assets/javascripts/components/components/video_player.jsx21
2 files changed, 27 insertions, 1 deletions
diff --git a/app/assets/javascripts/components/components/status.jsx b/app/assets/javascripts/components/components/status.jsx
index 8cdbd5625..020d90a12 100644
--- a/app/assets/javascripts/components/components/status.jsx
+++ b/app/assets/javascripts/components/components/status.jsx
@@ -5,6 +5,7 @@ import PureRenderMixin    from 'react-addons-pure-render-mixin';
 import IconButton         from './icon_button';
 import DisplayName        from './display_name';
 import MediaGallery       from './media_gallery';
+import VideoPlayer        from './video_player';
 import { hashHistory }    from 'react-router';
 
 const Status = React.createClass({
@@ -65,7 +66,11 @@ const Status = React.createClass({
     }
 
     if (status.get('media_attachments').size > 0) {
-      media = <MediaGallery media={status.get('media_attachments')} />;
+      if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
+        media = <VideoPlayer media={status.getIn(['media_attachments', 0])} />;
+      } else {
+        media = <MediaGallery media={status.get('media_attachments')} />;
+      }
     }
 
     return (
diff --git a/app/assets/javascripts/components/components/video_player.jsx b/app/assets/javascripts/components/components/video_player.jsx
new file mode 100644
index 000000000..e680fb206
--- /dev/null
+++ b/app/assets/javascripts/components/components/video_player.jsx
@@ -0,0 +1,21 @@
+import ImmutablePropTypes from 'react-immutable-proptypes';
+import PureRenderMixin    from 'react-addons-pure-render-mixin';
+
+const VideoPlayer = React.createClass({
+  propTypes: {
+    media: ImmutablePropTypes.map.isRequired
+  },
+
+  mixins: [PureRenderMixin],
+
+  render () {
+    return (
+      <div style={{ cursor: 'default', marginTop: '8px', overflow: 'hidden', width: '196px', height: '110px', boxSizing: 'border-box', background: '#000' }}>
+        <video src={this.props.media.get('url')} autoPlay='true' loop={true} muted={true} style={{ width: '100%', height: '100%' }} />
+      </div>
+    );
+  }
+
+});
+
+export default VideoPlayer;