Capítulo 266 de 988

Chapter 266: canRenderMediaOnWeb()

Core Idea

_Part of the @remotion/web-renderer package.

Key Concepts

  • Arguments
  • width
  • height
  • container?
  • videoCodec?
  • audioCodec?
  • transparent?
  • muted?

Code Examples

const result = await canRenderMediaOnWeb({
  container: 'mp4',
  videoCodec: 'h264',
  width: 1920,
  height: 1080,
});

if (!result.canRender) {
  for (const issue of result.issues) {
    console.error(issue.message);
  }
} else {
  console.log('Ready to render!');
  console.log('Video codec:', result.resolvedVideoCodec);
  console.log('Audio codec:', result.resolvedAudioCodec);
}
  • What it demonstrates: Usage pattern for canRenderMediaOnWeb() from the official docs.

Reference Tables

TypeDescription
webcodecs-unavailableWebCodecs API is not available in this browser
container-codec-mismatchThe video codec is not supported for the selected container
invalid-dimensionsH.264 and H.265 require width and height to be multiples of 2
video-codec-unsupportedThe browser cannot encode the selected video codec
audio-codec-unsupportedThe browser cannot encode the selected audio codec
transparent-video-unsupportedTransparency requires VP8 or VP9 codec
webgl-unsupportedWebGL is required for 3D CSS transforms
output-target-unsupportedThe requested output target is not supported by this browser

Key Takeaways

  1. Understand arguments when working with canRenderMediaOnWeb().
  2. Understand width when working with canRenderMediaOnWeb().
  3. Understand height when working with canRenderMediaOnWeb().
  4. Understand container? when working with canRenderMediaOnWeb().
  5. Understand videocodec? when working with canRenderMediaOnWeb().

Connects To

  • Angular: related page in the Framework & Renderer Integrations section.
  • Figma: related page in the Framework & Renderer Integrations section.
  • use Gsap Timeline: related page in the Framework & Renderer Integrations section.