mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-28 11:23:45 +02:00
Avoid opaque canvases in case of Firefox (fixes #117)
This commit is contained in:
+6
-2
@@ -15,6 +15,7 @@ import {
|
||||
toDataView,
|
||||
toUint8Array,
|
||||
SetRequired,
|
||||
isFirefox,
|
||||
} from './misc';
|
||||
|
||||
/**
|
||||
@@ -228,7 +229,10 @@ export class VideoSample {
|
||||
}
|
||||
|
||||
const canvas = new OffscreenCanvas(width, height);
|
||||
const context = canvas.getContext('2d', { alpha: false, willReadFrequently: true });
|
||||
const context = canvas.getContext('2d', {
|
||||
alpha: isFirefox(), // Firefox has VideoFrame glitches with opaque canvases
|
||||
willReadFrequently: true,
|
||||
});
|
||||
assert(context);
|
||||
|
||||
// Draw it to a canvas
|
||||
@@ -343,7 +347,7 @@ export class VideoSample {
|
||||
dest.set(this._data);
|
||||
} else {
|
||||
const canvas = this._data;
|
||||
const context = canvas.getContext('2d', { alpha: false });
|
||||
const context = canvas.getContext('2d');
|
||||
assert(context);
|
||||
|
||||
const imageData = context.getImageData(0, 0, this.codedWidth, this.codedHeight);
|
||||
|
||||
Reference in New Issue
Block a user