Skip to Content

Video

Describes a video.

Type Definition

type Video { thumb: String url: String title: String description: String tags: [String] aiProcessed: Boolean width: Int height: Int aspectRatio: String mimeType: String fileExtension: String fileSize: Int orientation: String duration: Int definition: String youtubeId: String vimeoId: String sortOrder: Int type: String }

Fields

FieldTypeNullableDescriptionRelated Types
thumbStringYesThe thumbnail of the video.
urlStringYesThe URL of the video.
titleStringYesThe title of the video.
descriptionStringYesThe description of the video.
tags[String]YesThe tags of the video.String
aiProcessedBooleanYesWhether the video has been processed by AI.
widthIntYesThe width of the video (in pixels).
heightIntYesThe height of the video (in pixels).
aspectRatioStringYesThe aspect ratio of the video, e.g. 16:9.
mimeTypeStringYesThe mime type of the video.
fileExtensionStringYesThe file extension of the video.
fileSizeIntYesThe size of the video (in bytes).
orientationStringYesThe orientation of the video, e.g. landscape.
durationIntYesThe duration of the video (in seconds).
definitionStringYesThe definition of the video (e.g. HD, SD).
youtubeIdStringYesThe YouTube ID of the video.
vimeoIdStringYesThe Vimeo ID of the video.
sortOrderIntYesThe sort order of the video.
typeStringYesThe type of the media.

Relationships

  • The tags field is a list of strings representing tags associated with the video.
  • The fields youtubeId and vimeoId relate the video to external video platforms (YouTube and Vimeo respectively) by their platform-specific IDs.
  • No direct relationships to other GraphQL object types are defined beyond the scalar and list of strings fields.

Usage Examples

Basic Query

{ video { title url description } }

Field Selection

{ video { thumb title tags duration mimeType fileSize } }

Nested Queries

The Video type does not contain nested object fields, but you can query related fields such as tags (list of strings) and platform IDs:

{ video { title tags youtubeId vimeoId } }

Filtering and Sorting

The Video type includes a sortOrder field which can be used for sorting videos in a list. Filtering by fields such as aiProcessed or tags can be implemented in queries that return lists of videos (assuming the schema supports it).

Example query to get videos sorted by sortOrder ascending and filtered by AI processed status:

{ videos(filter: { aiProcessed: true }, sort: { sortOrder: ASC }) { title url sortOrder aiProcessed } }

Note: The above assumes the existence of a videos query with filtering and sorting capabilities in the API schema.

Implements

The Video type does not explicitly implement any interfaces.

Connections

No connection fields are defined on the Video type itself. Pagination and connection handling would depend on the queries or mutations returning lists of Video objects.

  • [String] — used for the tags field representing a list of tag strings.

Best Practices

  • Use the sortOrder field to control the display order of videos in lists.
  • When querying videos, select only the fields you need to reduce payload size and improve performance.
  • Use the aiProcessed field to filter videos that have been processed by AI for specialized handling.
  • Use platform-specific IDs (youtubeId, vimeoId) to embed or link videos from external services.
  • Consider caching video metadata responses to improve performance, especially for frequently accessed videos.
  • Use the duration, width, height, and aspectRatio fields to optimize video player UI and experience.

Notes

  • All fields on the Video type are optional and may be null if data is not available.
  • The API currently requires no authentication, but this may change in future versions.
  • The fileSize field represents the size of the video file in bytes; use this to manage bandwidth and storage considerations.
  • The type field can be used to distinguish different media types if your application supports multiple media formats.
  • No computed or derived fields are defined on the Video type.
  • No field arguments are defined on the Video type fields.

For all queries, use the endpoint:

https://www.mystoreurl.com/graphql/0.8.0/

Example full query with error handling in JavaScript:

async function fetchVideoById(videoId) { const query = ` query GetVideo($id: Int!) { video(id: $id) { title url description duration tags } } `; const variables = { id: videoId }; try { const response = await fetch('https://www.mystoreurl.com/graphql/0.8.0/', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ query, variables }), }); const { data, errors } = await response.json(); if (errors) { console.error('GraphQL errors:', errors); return null; } return data.video; } catch (error) { console.error('Network error:', error); return null; } }
Last updated on