fix handling of inline videos
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": true,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "Format of this video is not recognized",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": true,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,6 +864,10 @@
|
||||
"defaultMessage": "Unnamed",
|
||||
"description": "Title shown when the topic has no name"
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid"
|
||||
},
|
||||
"update_available": {
|
||||
"defaultMessage": "Update available.",
|
||||
"description": "Message shown when an app update is available."
|
||||
|
||||
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": true,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": true,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": true,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": true,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": true,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,5 +1542,12 @@
|
||||
"description": "Label for call in progress",
|
||||
"missing": false,
|
||||
"obsolete": false
|
||||
},
|
||||
"unrecognized_video_format": {
|
||||
"translation": "",
|
||||
"defaultMessage": "Format of this video is not recognized",
|
||||
"description": "Error message when uploaded video is invalid",
|
||||
"missing": true,
|
||||
"obsolete": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1013,7 +1013,7 @@ class MessagesView extends React.Component {
|
||||
|
||||
if (uploads.length == 0) {
|
||||
// Both video and preview are small enough to send inband.
|
||||
Promise.all(blobToBase64(videoBlob), blobToBase64(previewBlob))
|
||||
Promise.all([blobToBase64(videoBlob), blobToBase64(previewBlob)])
|
||||
.then(b64s => {
|
||||
const [v64, i64] = b64s;
|
||||
let msg = Drafty.insertVideo(null, 0, {
|
||||
@@ -1313,6 +1313,7 @@ class MessagesView extends React.Component {
|
||||
content={this.state.videoPreview}
|
||||
tinode={this.props.tinode}
|
||||
reply={this.state.reply}
|
||||
onError={this.props.onError}
|
||||
onCancelReply={this.handleCancelReply}
|
||||
onClose={this.handleClosePreview}
|
||||
onSendMessage={this.sendVideoAttachment} />
|
||||
@@ -1330,6 +1331,7 @@ class MessagesView extends React.Component {
|
||||
<VideoPreview
|
||||
content={this.state.videoPostview}
|
||||
tinode={this.props.tinode}
|
||||
onError={this.props.onError}
|
||||
onClose={this.handleClosePreview} />
|
||||
);
|
||||
} else if (this.state.docPreview) {
|
||||
|
||||
@@ -140,7 +140,7 @@ class CallPanel extends React.PureComponent {
|
||||
|
||||
start() {
|
||||
if (this.state.localStream) {
|
||||
this.props.onError(this.props.intl.formatMessage(messages.already_in_call));
|
||||
this.props.onError(this.props.intl.formatMessage(messages.already_in_call), 'info');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
||||
import SendMessage from './send-message.jsx';
|
||||
|
||||
import { bytesToHumanSize } from '../lib/strformat.js';
|
||||
|
||||
export default class VideoPreview extends React.PureComponent {
|
||||
const messages = defineMessages({
|
||||
unrecognized_video_format: {
|
||||
id: 'unrecognized_video_format',
|
||||
defaultMessage: 'Format of this video is not recognized',
|
||||
description: 'Error message when uploaded video is invalid',
|
||||
}
|
||||
});
|
||||
|
||||
class VideoPreview extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
@@ -23,6 +31,11 @@ export default class VideoPreview extends React.PureComponent {
|
||||
name: this.props.content.filename
|
||||
}
|
||||
|
||||
if (params.width == 0 || params.height == 0) {
|
||||
this.props.onError(this.props.intl.formatMessage(messages.unrecognized_video_format), 'err');
|
||||
return;
|
||||
}
|
||||
|
||||
// Capture screen from a video.
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = params.width;
|
||||
@@ -55,7 +68,7 @@ export default class VideoPreview extends React.PureComponent {
|
||||
<div id="image-preview-container">
|
||||
<video
|
||||
className="image-preview"
|
||||
controls controlist={controlist}
|
||||
controls controlsList={controlist}
|
||||
disablePictureInPicture ref={this.videoRef}
|
||||
autoPlay={autoPlay}
|
||||
src={this.props.tinode.authorizeURL(this.props.content.url)}
|
||||
@@ -93,3 +106,5 @@ export default class VideoPreview extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default injectIntl(VideoPreview);
|
||||
|
||||
Reference in New Issue
Block a user