Skip to content

Commit

Permalink
clobber mimetype on receive, not send
Browse files Browse the repository at this point in the history
  • Loading branch information
ara4n committed Mar 22, 2022
1 parent 6a46c7a commit 9d151a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/ContentMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,12 +595,6 @@ export default class ContentMessages {
// if we have a mime type for the file, add it to the message metadata
if (file.type) {
content.info.mimetype = file.type;

// clobber quicktime muxed files to be considered MP4 so browsers
// are willing to play them
if (content.info.mimetype == "video/quicktime") {
content.info.mimetype = "video/mp4";
}
}

const prom = new Promise<void>((resolve) => {
Expand Down
13 changes: 11 additions & 2 deletions src/components/views/messages/MVideoBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,21 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
} else {
logger.log("NOT preloading video");
const content = this.props.mxEvent.getContent<IMediaEventContent>();

let mimetype = content?.info?.mimetype;

// clobber quicktime muxed files to be considered MP4 so browsers
// are willing to play them
if (mimetype == "video/quicktime") {
mimetype = "video/mp4";
}

this.setState({
// For Chrome and Electron, we need to set some non-empty `src` to
// enable the play button. Firefox does not seem to care either
// way, so it's fine to do for all browsers.
decryptedUrl: `data:${content?.info?.mimetype},`,
decryptedThumbnailUrl: thumbnailUrl || `data:${content?.info?.mimetype},`,
decryptedUrl: `data:${mimetype},`,
decryptedThumbnailUrl: thumbnailUrl || `data:${mimetype},`,
decryptedBlob: null,
});
}
Expand Down

0 comments on commit 9d151a3

Please sign in to comment.