Skip to main content

Media

We provide a standard set of choosers for media types, including images and video, to make it easy for users to choose media to add to their content. When a chooser definition is included in a content type, the content form user interface allows the user to choose images or video from their media library using a simple media browser.

The supported media choosers are shown below:

ChooserSchema
Imagehttp://bigcontent.io/cms/schema/v1/core#/definitions/image-link
Videohttp://bigcontent.io/cms/schema/v1/core#/definitions/video-link

Images
Link copied!

An example property for an image is shown below.

The allOf keyword specifies that only an image can be chosen.


"image": {
"title": "Background image",
"description": "A background image",
"type": "object",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link"
}
]
}

Video
Link copied!

An example video is shown below.

In this case the allOf keyword specifies that only a video can be chosen.


"image": {
"title": "Video",
"description": "Video used for the banner",
"type": "object",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/video-link"
}
]
}

Images and video
Link copied!

If we wanted the background to be either an image or a video, then the anyOf keyword can be used and both the image and video choosers specified. The user will then be able to choose a single image or video.

Once the content is saved, the media property of this content item will contain a reference to an image or video.

"media": {
"title": "Background media",
"description": "The background image or video",
"type": "object",
"anyOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link"
},
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/video-link"
}
]
}

[The Schema Editor](/docs/dev-tools/guides-tutorials/schema-editor

Data types