Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current state of browser support for native alpha vs. seeThru #47

Open
jcklpe opened this issue Oct 12, 2017 · 10 comments
Open

Current state of browser support for native alpha vs. seeThru #47

jcklpe opened this issue Oct 12, 2017 · 10 comments

Comments

@jcklpe
Copy link

jcklpe commented Oct 12, 2017

I'm just checking in. Seems that this project is being actively developed. I see that alpha video was put into Chrome about a year ago, but when I try and look up support for other browsers I can't find anything. Should I consider the state of alpha video in browsers to require this hack for the forseeable future?

@m90
Copy link
Owner

m90 commented Oct 13, 2017

I have to admit I haven't used this in production since I initially created it in early 2012, so my knowledge about the latest developments in terms of browser support is rather limited.

From what I have heard of others that have used it more recently the most future proof way of handling with transparent video is probably using native transparencies if available (i.e. Chrome) and use seeThru as a fallback only. Ideally this should make seeThru render itself useless over time.

That's about all the input I can give you on this, but I'll leave this issue open for discussion in case someone else with more recent experience comes along.

@m90 m90 changed the title Current State of this project? Current state of browser support for native alpha vs. seeThru Oct 13, 2017
@jcklpe
Copy link
Author

jcklpe commented Oct 13, 2017 via email

@rhelling
Copy link
Collaborator

rhelling commented Oct 26, 2017

I'm currently running this on https://ultimaker.com/ using a video element with a webm and a mp4. When the browser doesn't has support for webm i load seethru. I'm working for ultimaker to build a new frontend, so this is temporary solution. It might be valueble to document how to use seethru as a 'polyfill' like this:

const video = document.createElement('video');
if ($videoElement.length && video && !video.canPlayType('video/webm')) {
    if (/iP(od|hone|ad)/.test(window.userAgent) && $videoElement.attr('crossorigin')) {
        // do not use cdn on iOS as it doesn't support crossorigin attribute on video elements
        $videoElement.find('source').each((index, s) => {
            s.src = s.src.replace(/http(s|):\/\/[^/]*/, '');
        });
    }
    this.sequences[switchId] = seeThru.create($videoElement, {alphaMask: true});
}
else {
    this.sequences[switchId] = $videoElement;
}
<video class="alpha" autoplay="" playsinline="" loop="" muted="" oncanplay="this.play()" onended="this.play()" crossorigin="anonymous">
	<source src="//d3v5bfco3dani2.cloudfront.net/src/media/video/products/um3/hero/hero_loop_alpha.webm" type="video/webm">
	<source src="//d3v5bfco3dani2.cloudfront.net/src/media/video/products/um3/hero/hero_loop_alpha.mp4" type="video/mp4">
</video>

@ataylor32
Copy link

These days, if you use two different video formats (WebM and HEVC), you can have a transparent video that works in all of the major browsers except Internet Explorer with a simple <video> tag:

<video>
  <source src="video.webm" type="video/webm">
  <source src="video.mov" type="video/quicktime">
</video>

Here's a demo you can test with

@safeisnotanoption
Copy link

@ataylor32 what software do you use to convert videos to HEVC?

@ataylor32
Copy link

@safeisnotanoption https://kitcross.net/hevc-web-video-alpha-channel/

@safeisnotanoption
Copy link

@ataylor32 Are there any converters that work on other OS?

@ataylor32
Copy link

@safeisnotanoption Not that I'm aware of

@Xamsix
Copy link

Xamsix commented Jan 8, 2021

@ataylor32 discovered today that the transparent mov is only supported in newer Safari browsers. For example safari 11, which was released only 3 years ago, it wont work. So I do think I'll be using this tool now.

@marcusx2
Copy link

marcusx2 commented Sep 2, 2023

These days, if you use two different video formats (WebM and HEVC), you can have a transparent video that works in all of the major browsers except Internet Explorer with a simple <video> tag:

<video>
  <source src="video.webm" type="video/webm">
  <source src="video.mov" type="video/quicktime">
</video>

Here's a demo you can test with

While that's true, this doesn't work for WebGL applications. Safari on iOS 16.4 and later do not respect the alpha channel of HEVC files. Same for Safari on MacOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants