🎥 Make videos programmatically with React
`@remotion/media`: make video canvas transparent
Igor Samokhovetsda730c19c1b2
diff --git a/packages/media/src/video/media-player.ts b/packages/media/src/video/media-player.tsindex 9a587254bf..ce4d58cdaa 100644--- a/packages/media/src/video/media-player.ts+++ b/packages/media/src/video/media-player.ts@@ -118,7 +118,7 @@ export class MediaPlayer {if (canvas) {const context = canvas.getContext('2d', {- alpha: false,+ alpha: true,desynchronized: true,});@@ -225,7 +225,7 @@ export class MediaPlayer {});if (startTime === null) {- this.context?.clearRect(0, 0, this.canvas!.width, this.canvas!.height);+ this.clearCanvas();return {type: 'success', durationInSeconds: this.totalDuration};}@@ -264,6 +264,12 @@ export class MediaPlayer {}}+ private clearCanvas(): void {+ if (this.context && this.canvas) {+ this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);+ }+ }+private cleanupAudioQueue(): void {for (const node of this.queuedAudioNodes) {node.stop();@@ -297,7 +303,7 @@ export class MediaPlayer {});if (newTime === null) {- this.context?.clearRect(0, 0, this.canvas!.width, this.canvas!.height);+ this.clearCanvas();await this.cleanAudioIteratorAndNodes();return;}