You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-11 20:22:36 +03:00
Tweak video component code style
This commit is contained in:
@@ -71,7 +71,7 @@ export default class MVideoBody extends React.PureComponent<IProps, IState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_getContentUrl(): string|null {
|
private getContentUrl(): string|null {
|
||||||
const content = this.props.mxEvent.getContent();
|
const content = this.props.mxEvent.getContent();
|
||||||
if (content.file !== undefined) {
|
if (content.file !== undefined) {
|
||||||
return this.state.decryptedUrl;
|
return this.state.decryptedUrl;
|
||||||
@@ -80,7 +80,7 @@ export default class MVideoBody extends React.PureComponent<IProps, IState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_getThumbUrl(): string|null {
|
private getThumbUrl(): string|null {
|
||||||
const content = this.props.mxEvent.getContent();
|
const content = this.props.mxEvent.getContent();
|
||||||
if (content.file !== undefined) {
|
if (content.file !== undefined) {
|
||||||
return this.state.decryptedThumbnailUrl;
|
return this.state.decryptedThumbnailUrl;
|
||||||
@@ -142,8 +142,8 @@ export default class MVideoBody extends React.PureComponent<IProps, IState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _videoOnPlay() {
|
private videoOnPlay = async () => {
|
||||||
if (this._getContentUrl() || this.state.fetchingData || this.state.error) {
|
if (this.getContentUrl() || this.state.fetchingData || this.state.error) {
|
||||||
// We have the file, we are fetching the file, or there is an error.
|
// We have the file, we are fetching the file, or there is an error.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -195,8 +195,8 @@ export default class MVideoBody extends React.PureComponent<IProps, IState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentUrl = this._getContentUrl();
|
const contentUrl = this.getContentUrl();
|
||||||
const thumbUrl = this._getThumbUrl();
|
const thumbUrl = this.getThumbUrl();
|
||||||
let height = null;
|
let height = null;
|
||||||
let width = null;
|
let width = null;
|
||||||
let poster = null;
|
let poster = null;
|
||||||
@@ -217,7 +217,7 @@ export default class MVideoBody extends React.PureComponent<IProps, IState> {
|
|||||||
<span className="mx_MVideoBody">
|
<span className="mx_MVideoBody">
|
||||||
<video className="mx_MVideoBody" src={contentUrl} title={content.body}
|
<video className="mx_MVideoBody" src={contentUrl} title={content.body}
|
||||||
controls preload={preload} muted={autoplay} autoPlay={autoplay}
|
controls preload={preload} muted={autoplay} autoPlay={autoplay}
|
||||||
height={height} width={width} poster={poster} onPlay={this._videoOnPlay.bind(this)}>
|
height={height} width={width} poster={poster} onPlay={this.videoOnPlay}>
|
||||||
</video>
|
</video>
|
||||||
<MFileBody {...this.props} decryptedBlob={this.state.decryptedBlob} />
|
<MFileBody {...this.props} decryptedBlob={this.state.decryptedBlob} />
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user