Video

Video info are stored in a JSON document directly on swarm.

The JSON contains various details such as video title and description, video duration, quality and sources. Each source has its own info such as quality, size, bitrate and reference to the hash.

Schema versions

Schema v2.0

preview

type SwarmVideoPreview = {
    /** Schema version */
    v: "2.0"
    /** Title of the video */
    title: string
    /** Video creation timestamp */
    createdAt: number
    /** Video creation timestamp */
    updatedAt?: number | null
    /** Address of the owner of the video */
    ownerAddress: string
    /** Duration of the video in seconds */
    duration: number
    /** Thumbnail raw image */
    thumbnail?: SwarmImage | null
}

The schema info for the image can be found here.

detail

Regarding the hls and dash source type, each transcoded source is referenced in the list, but only the video sources (or playlists in case of hls) have the size field set. This is useful to calculate the price of the video depending on the selected quality in the player.

For the master playlist or dash manifest, the size field is set to 0.

Folders

Video v2 is folder based, so each resource is included under the same swarm hash.

The thumbnail images are store in a folder named thumb, while the video sources and manifests are stored under the sources folder.

Preview / Details files

The preview and details are 2 seprate files stored in root path of the video folder, with the same name without extension.

Both files are of application/json format and they are accessible at the url /bzz/<hash>/preview and /bzz/<hash>/details. The preview file is also set to be default entry point of the folder, hence it is also accessible at the url /bzz/<hash>.

preview example:

details example:

Schema v1.2

Schema v1.1

Schema v1.0

source example

Feed

The video does NOT implement a feed to avoid user’s direct manipulation of the manifest data without the index consent.

To have both a static hash (for SEO purpose) and decentralization, the video will have two links:

  • A static one provided by the index (used in home, search, frame pages)

  • A dynamic one with the direct reference to the swarm manifest hash (used in channel page, channel playlists)

Last updated