I have a web application build on NextJS. I intend to use a transparent video, which currently I have as MOV and WEBP, WEBP works absolutely fine on Chrome (Desktop), while MOV works fine on Safari (Desktop). But I am facing issues when it come to Chrome (IOS), Chrome (Android) has no issues. However Chrome (IOS) does not show the alpha channels, it shows a while background. How can I fix this? what is the best approach for this, or is there any other file type that I should use?
2
Answers
There are multiple approaches to this.
The first option is to use a different video format. You speak of using webP, but have a look at VP9/WebM. Have a look at its possible implementation. Google itself also speaks on the uses and shortcomings of webP.
As a second option, as some commenters already mentioned, one way is to have two videos. One being the mask and one to have the colors. For that, you can see the following example that uses the HTML canvas.
Important Note: Please click the ‘full page’ button to properly see the snippet in action. Else, scroll down after pressing p to play.
Credit: Nathan Searles
To support transparent video on web applications for both desktop and mobile, use the WebM format with VP9 codec and alpha channel. This format is widely supported across modern browsers.
Implementation Steps
Create Transparent Video: Export your video in WebM format using VP9 with alpha channel (e.g., with Adobe After Effects).
Embed in HTML:
Fallback Solutions: Provide GIF or PNG sequences for browsers like Safari that do not support WebM with VP9.
Browser Compatibility
Chrome, Firefox, Edge: Full support on desktop and mobile.
Safari: Use fallback methods (PNG/GIF).
This ensures the best transparency support across most browsers.