Object

VideoFill

The object for adding a video background fill to a component.

Properties

stillURL
uri
(Required)

The URL of the image file to use as a still image when the video is not playing.

Image URLs can begin with http://, https://, or bundle://. If the image URL begins with bundle://, the referenced image file must be in the same directory as the document.

Image filenames should be properly encoded as URLs.

See Preparing Image, Video, Audio, Music, and ARKit Assets.

URL
uri
(Required)

The URL of a video file that can be played using AV Player. HTTP Live Streaming (HLS) is highly recommended (.M3U8). For more information about HLS, see HTTP Live Streaming.

attachment
string

A string that indicates how the fill should behave when a user scrolls.

Valid values:

  • scroll (default). The fill scrolls along with its component.

  • fixed. The fill stays at a fixed position within the viewport.

fillMode
string

Indicates how the video fill should be displayed.

Valid values:

  • fit: Preserves the video aspect ratio and fits the fill within the component.

  • cover (default): Preserves the video aspect ratio and fills to the boundaries of the component.

horizontalAlignment
string

Sets the horizontal alignment of the video fill within its component.

Valid values:

  • left: Aligns the left edge of the fill with the left edge of the component.

  • center (default): Aligns the horizontal center of the fill with the center of the component.

  • right: Aligns the right edge of the fill with the right edge of the component.

You can use fillMode with horizontalAlignment to achieve the effect you want. For example, set fillMode to fit and horizontalAlignment to left to fit the video based on its aspect ratio and also align the left edge of the fill with the left edge of the component. Or set fillMode to cover and horizontalAlignment to right to scale the video horizontally and also align the right edge of the fill with the right edge of the component.

loop
boolean

When true, it specifies that the video will start over again when it reaches the end.

type
string
(Required)

Describes the type of fill. Must be video for a video fill.

verticalAlignment
string

Sets the vertical alignment of the video fill within its component.

Valid values:

  • top: Aligns the top of the fill with the top edge of the component.

  • center (default): Aligns the vertical center of the fill with the center of the component.

  • bottom: Aligns the bottom of the fill with the bottom edge of the component.

You can use fillMode with verticalAlignment to achieve the effect you want. For example, set fillMode to fit and verticalAlignment to top to fit the video based on its aspect ratio and also align the top of the fill with the top edge of the component. Or set fillMode to cover and verticalAlignment to top to scale the video vertically and also align the top of the fill with the top edge of the component.

Discussion

Use the VideoFill object to fill a component’s background with a video that starts playing automatically with no audio. You can specify whether the video scrolls or stays in one place when the user scrolls, what happens when the video ends, and the position of the video within the component. You can also supply an image to display when the video is not playing.

This object can be used in ComponentStyle.

Example

{ "components": [ { "role": "container", "style": "exampleComponentStyle", "layout": { "ignoreDocumentMargin": true, "minimumHeight": 150 }, "components": [ { "role": "title", "text": "Season Preview: Nobody Saw This Coming", "anchor": { "targetAnchorPosition": "center" } } ] } ], "componentStyles": { "exampleComponentStyle": { "fill": { "type": "video", "URL": "https://example.com/hls/2014/fded0-1077dae/main.m3u8", "stillURL": "bundle://video-still.jpg", "fillMode": "cover", "verticalAlignment": "top" } } }}

Relationships

Inherits From

See Also

Backgrounds for Components

Applying a Background to a Component

Change the appearance of the backgrounds in your article.

object ImageFill

The object for adding an image background fill to a component.

object RepeatableImageFill

The object for adding a background image that can be repeated.

object LinearGradientFill

The object for displaying a linear gradient as a component background.

object GradientFill

The properties shared by all gradient fill types.

object Fill

The object for setting a fill type and attachment for a component’s background fill.

object ColorStop

The object for specifying the color and location for a color stop in a gradient.