Comments (1)
Here's the Zulip code around this:
def is_video(self, url: str) -> bool:
if not self.zmd.image_preview_enabled:
return False
url_type = mimetypes.guess_type(url)[0]
# Support only video formats (containers) that are supported cross-browser and cross-device. As per
# https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#index_of_media_container_formats_file_types
# MP4 and WebM are the only formats that are widely supported.
supported_mimetypes = ["video/mp4", "video/webm"]
return url_type in supported_mimetypes
As detailed in https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#index_of_media_container_formats_file_types, the .mov
format isn't supported in some major browsers, like Firefox. (I haven't found a good resource on why Firefox doesn't support it, but I'm guessing it relates to Quicktime's history as a proprietary Apple technology).
There are other ways we could handle this -- re-encoding videos is a lot of CPU and not likely a great plan, but we could consider rendering the preview elements and just hiding them on browsers that don't support codecs like this... with the downside being that it'd just fail to work for Firefox users, without much hint to the person posting the message. It's worth some testing on what firefox does with a player element for an unsupported format.
Another direction would be to just communicate when you upload a .mov
that we're not generating a preview because that format isn't widely supported by all browsers.
from zulip.
Related Issues (20)
- Fix incorrect "Copied" notice when visiting a custom playground HOT 1
- Persona : Enhancing Zulip for Professionals HOT 1
- Fix hard to see table border color in dark mode
- Fix error when rendering fenced code block with wierdly formated dictionary in doc.md file HOT 2
- custom_profile_fields: Delete modal will not appear in select field for edge case HOT 1
- Add synchronization in deactivating users. HOT 2
- Fix "action column in deactivated users table.
- Fix action column in deactivated users table. HOT 6
- custom_profile_fields: mark display_in_profile_summary as optional in api documentation HOT 2
- Add type to replace `HTMLSelectElement & {type: "select-one"}` HOT 3
- Start new conversation button's tooltip not updating in DM narrow when direct messages are disabled. HOT 1
- Multiple custom profile fields with type "pronoun" cannot be edited/updated. HOT 5
- Support the DEVONThink x-devonthink-item:// URI scheme HOT 1
- Add OpenProject integration HOT 1
- Implement 3-way compose box resizing HOT 1
- Position compose typeaheads near cursor
- Error thrown while selecting stream in the "Move messages" modal. HOT 1
- Support AVIF in inline-preview HOT 2
- Add a "Contact support" link to help menu HOT 1
- Get messages before the specified date.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zulip.