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

transparent player, why is alpha set false, with no override #153

Open
icyield opened this issue Apr 17, 2019 · 5 comments
Open

transparent player, why is alpha set false, with no override #153

icyield opened this issue Apr 17, 2019 · 5 comments

Comments

@icyield
Copy link

icyield commented Apr 17, 2019

I would like to play an alpha video on a background, but the VideoContext webglContextAttributes alpha Can't be overriden because it is copied last.

Why is this done? If I change it to true works as expected, giving transparent player.

=====================================

`_classCallCheck(this, VideoContext);

            this._canvas = canvas;
            this._endOnLastSourceEnd = endOnLastSourceEnd;

            this._gl = canvas.getContext("experimental-webgl", Object.assign({ preserveDrawingBuffer: true }, // can be overriden
            webglContextAttributes, { alpha: false // Can't be overriden because it is copied last
            }));`
@icyield icyield changed the title transparent player, why is alpha set false, with no overide transparent player, why is alpha set false, with no override Apr 17, 2019
@PTaylour
Copy link
Contributor

I assume it's set to false to help with performance.

However, I can't think of a reason why it shouldn't be overridable.

@gsouquet do you guys have any opinions on this?

@germain-gg
Copy link
Contributor

I remember seeing a comment from Matthew in the code

if (webglContextAttributes.alpha === true){
  console.error("webglContextAttributes.alpha must be false for correct opeation");
}

I assume it has to do with performance as you said but possible with fidelity of the output. With new APIs like MediaRecorder you could end up with a different output than what you have previewed in your browser.

This would need to be investigated a bit more. I think the default has to be alpha: false for sure. But I can't see major problems that would arise with letting developers override that

@germain-gg
Copy link
Contributor

Actually looking at #154 , it seems like having an alpha set to true could be a risk.

If we decide to make the canvas desynchronised we won't have the ability to stack elements over the VC canvas.

We could probably allow the user to make that override, but the question becomes, how do we now communicate that behaviour to the developers to avoid frustration and hours of debugging?

Check https://developers.google.com/web/updates/2019/05/desynchronized#alpha_channels

How do you think we should move this forward?

@icyield
Copy link
Author

icyield commented Nov 7, 2019

The fact that alpha canvas might have some issues that make it more difficult to use is not really a reason to not allow users to override.

If this is really an issue then some code to catch an allowAlphaOverride in the context could be used. But you can't stop "frustration and hours of debugging" by not allowing something that a user requires.

var videoContextOptions = { endOnLastSourceEnd: true, webglContextAttributes: { preserveDrawingBuffer: true, allowAlphaOverride:true, alpha: true } };

@germain-gg
Copy link
Contributor

@icyield I believe I didn't explain myself correctly.
We could probably allow an alpha override. However if we are going to allow that I believe we should think about how we can communicate the limitations this brings with the desynchronised rendering.

Maybe through documentation or maybe make the library check if anything is stacked above the canvas. Not sure

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

No branches or pull requests

3 participants