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
| Field | Type | Nullable | Description | Related Types |
|---|---|---|---|---|
thumb | String | Yes | The thumbnail of the video. | |
url | String | Yes | The URL of the video. | |
title | String | Yes | The title of the video. | |
description | String | Yes | The description of the video. | |
tags | [String] | Yes | The tags of the video. | String |
aiProcessed | Boolean | Yes | Whether the video has been processed by AI. | |
width | Int | Yes | The width of the video (in pixels). | |
height | Int | Yes | The height of the video (in pixels). | |
aspectRatio | String | Yes | The aspect ratio of the video, e.g. 16:9. | |
mimeType | String | Yes | The mime type of the video. | |
fileExtension | String | Yes | The file extension of the video. | |
fileSize | Int | Yes | The size of the video (in bytes). | |
orientation | String | Yes | The orientation of the video, e.g. landscape. | |
duration | Int | Yes | The duration of the video (in seconds). | |
definition | String | Yes | The definition of the video (e.g. HD, SD). | |
youtubeId | String | Yes | The YouTube ID of the video. | |
vimeoId | String | Yes | The Vimeo ID of the video. | |
sortOrder | Int | Yes | The sort order of the video. | |
type | String | Yes | The type of the media. |
Relationships
- The
tagsfield is a list of strings representing tags associated with the video. - The fields
youtubeIdandvimeoIdrelate 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
videosquery 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.
Related Types
[String]— used for thetagsfield representing a list of tag strings.
Best Practices
- Use the
sortOrderfield 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
aiProcessedfield 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, andaspectRatiofields to optimize video player UI and experience.
Notes
- All fields on the
Videotype 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
fileSizefield represents the size of the video file in bytes; use this to manage bandwidth and storage considerations. - The
typefield can be used to distinguish different media types if your application supports multiple media formats. - No computed or derived fields are defined on the
Videotype. - No field arguments are defined on the
Videotype fields.
For all queries, use the endpoint:
https://www.mystoreurl.com/graphql/0.9.0Example 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.9.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;
}
}