diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-09-25 12:55:27 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-09-25 12:55:27 -0400 |
commit | a20c63ff35f6407d232f7e1d7dcbd3caeb74492e (patch) | |
tree | c730ccdf292f3f9fc34383aa16c7fa5b9fcd3fb8 | |
parent | f75475d3d053b6f9c4f28de2823302f439f3aec3 (diff) | |
download | chat-a20c63ff35f6407d232f7e1d7dcbd3caeb74492e.tar.gz chat-a20c63ff35f6407d232f7e1d7dcbd3caeb74492e.tar.bz2 chat-a20c63ff35f6407d232f7e1d7dcbd3caeb74492e.zip |
Force videos to be set dimensions.
-rw-r--r-- | web/react/components/view_image.jsx | 18 | ||||
-rw-r--r-- | web/react/utils/constants.jsx | 4 |
2 files changed, 18 insertions, 4 deletions
diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx index e645878c1..a7fecb689 100644 --- a/web/react/components/view_image.jsx +++ b/web/react/components/view_image.jsx @@ -1,10 +1,11 @@ // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. -var Client = require('../utils/client.jsx'); -var Utils = require('../utils/utils.jsx'); -var ViewImagePopoverBar = require('./view_image_popover_bar.jsx'); -var Modal = ReactBootstrap.Modal; +const Client = require('../utils/client.jsx'); +const Utils = require('../utils/utils.jsx'); +const Constants = require('../utils/constants.jsx'); +const ViewImagePopoverBar = require('./view_image_popover_bar.jsx'); +const Modal = ReactBootstrap.Modal; export default class ViewImageModal extends React.Component { constructor(props) { @@ -200,11 +201,20 @@ export default class ViewImageModal extends React.Component { </a> ); } else if (fileType === 'video' || fileType === 'audio') { + let width = Constants.WEB_VIDEO_WIDTH; + let height = Constants.WEB_VIDEO_HEIGHT; + if (Utils.isMobile()) { + width = Constants.MOBILE_VIDEO_WIDTH; + height = Constants.MOBILE_VIDEO_HEIGHT; + } + content = ( <video ref='video' data-setup='{}' controls='controls' + width={width} + height={height} > <source src={Utils.getWindowLocationOrigin() + '/api/v1/files/get' + filename} /> </video> diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index 8c9e1ee85..40d52c165 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -72,6 +72,10 @@ module.exports = { MAX_FILE_SIZE: 50000000, // 50 MB THUMBNAIL_WIDTH: 128, THUMBNAIL_HEIGHT: 100, + WEB_VIDEO_WIDTH: 640, + WEB_VIDEO_HEIGHT: 480, + MOBILE_VIDEO_WIDTH: 480, + MOBILE_VIDEO_HEIGHT: 360, DEFAULT_CHANNEL: 'town-square', OFFTOPIC_CHANNEL: 'off-topic', GITLAB_SERVICE: 'gitlab', |