Skip to main content
Renders an embedded web page. Similar to <iframe> element in HTML, but with the following essential differences:
  • You can only use one WebFrame element inside a VCS composition. (In other words, WebFrame is a “singleton”.)
    • Creating multiple WebFrame elements is undefined behavior. They will render the same content even if you set different source URLs. To avoid this, use only one WebFrame element in your composition.
  • The WebFrame element doesn’t update at a guaranteed frame rate. You should assume the content will be refreshed about two times per second (2 fps).
  • You can control the web page by sending keyboard events to it (see section below).
In practice, WebFrame behaves a lot like an image component that renders a live web page instead of a static image asset. You can use all the props that exist on <Image>.
WebFrame is ideal for displaying embedded documents or web-based live widgets, but it is not a media player. You shouldn’t use it for web pages that contain video or dynamic animated content because the frame rate is too low. (To play online video sources in a Daily room, you can use Remote Media Player, a beta feature. Remote Media Player behaves like a participant in the room so it doesn’t require any special handling in VCS. For more information about Remote Media Player,.)
The src prop sets the URL of the web page to be loaded. Note that VCS will load this URL on Daily’s cloud-based media servers, so the page must be publicly accessible. The viewportSize prop sets the size of the embedded browser window in pixels. The value must be an object containing properties w and h. You should always set this prop to a value that fits your content. If unset, WebFrame will use a default viewport size. The default size is currently 1280*720 pixels, but could change depending on rendering environment.
The choice of viewport size is very important to make your web page look good when embedded in a video stream. If you use a large viewport size, text within the web page may become too small to read after it’s been encoded into video. It’s usually better to use a smaller viewport to make the page elements more legible. Remember that the WebFrame element scales just like an image, so you don’t have to use a viewport size that matches your output video size exactly. (Your web browser’s Developer Tools can be useful in determining a suitable size: load up the page you want to embed, open Developer Tools, and resize the window; the viewport size will be displayed as you resize.)
Code example:

Props

Properties specific to the <WebFrame> component: Properties shared with the <Image> component: Properties available to all VCS components, including this one.

style prop

The style prop accepts an object that can have the following values set:

Sending events to the web page

You can interact with the page loaded into a WebFrame by sending it a key press action, a simulated keyboard event. This is particularly useful for document viewers. For example, if you’re embedding a Google Slides presentation, you might want to first send a key press to enter slideshow mode, then send arrow keys to navigate between slides. The key press action is described using a prop called keyPressAction, which is available on the WebFrame component. Its value must be an object with the following properties:
  • name - the name of the key to be pressed. (See below for list of key names.)
  • modifiers - a list of modifier keys to be activated for the key press.
    • Possible values are: "Shift", "Control", "Alt", "Meta"
    • On a Mac keyboard, "Alt" is equal to Option and "Meta" is equal to Command.
    • You should combine the keys with a plus sign. E.g. "Shift+Meta"
  • key - a unique identifier for this specific key press.
    • Should be an integer greater than zero.
The key property is required because a key press is functionally an event occurring at a specific moment in time (the simulated key is pressed and depressed). Because the same keys can be pressed over and over, we need a way to tell VCS when a key press has just happened. The key property accomplishes this. When you update key to a new value, VCS will send the simulated event to the embedded browser.
Note that ‘key’ in this context means something other than a key on the physical keyboard. We opted to follow the established convention of React, where ‘key’ means this kind of distinguishing unique identifier.

Key names

The following key names are supported:
  • Digits 0 - 9
  • Letters A - Z
  • ASCII special characters, e.g. !, @, +, >, etc.
  • Function keys F1 - F12
  • Enter
  • Escape
  • Backspace
  • Tab
  • Arrow keys ArrowUp, ArrowDown, ArrowLeft, ArrowRight
  • PageDown, PageUp
You can combine these with the modifiers listed previously.

Code example

The following example functions create key press actions to control a Google Slides document.
Note that the returned object from these functions would be used as the keyPressAction prop value for a WebFrame component. (In a real application, you’d probably want to store kpkey in a React ref within the component that contains the WebFrame.)