Skip to main content

Media

Below you can view an example of the media block in JSON format.

{
{
"type": "codex_media",
"text": null,
"marks": [],
"content": null,
"attrs": {
"media": [
{
"id": "as3LY3YekK29wUG3H",
"type": 1
}
],
"blockId": "bl60fb4173068f4c018771",
"src": null,
"align": "center",
"caption": "",
"width": "70%"
},
"contentHTML": null
}
}
info

Media block is used for using Codex Assets or VPP Videos and Playlists in the Rich Content field with Codex Editor. You can query all media in Codex GraphQL API through an extra media field which is added by the GraphQL engine. Read more about using reference block in GraphQL here.

Below you can read details about each attribute of the media block.

type

A string that represents the type of the block. Image blocks will always display codex_media as their type.

attrs

An object that represents the attributes of the block.

attrs.media

A list of objects that represent the media inserted in the block. Each media object contains:

type - a int enum type that represents the type of the media. Possible values are

  1. Image
  2. File
  3. Video
  4. Playlist

id - a string that represents the respective media identifier.

attrs.blockId

A string that represents the unique block ID of the image.

attrs.src

A string that represents the source(file location) of the image.

attrs.caption

A string that represents the caption of the image.

attrs.align

A string that represents the image alignment. This value can be left, center, or right.

attrs.width

A string that represents the image width. This value can be a numberfollowed by a percentage.

content

An array that represents the content of the image.

contentHTML

A string that represents the generated HTML of the block.