connect
search

Ad Break Markers

Prerequisites

  • An organization

  • Bucket(s)

  • One or more video files

Workflow

Important

All GraphQL queries and mutations related to ad breaks require the internal ID of the file(s) being operated on.

You must first obtain the internal file IDs with a query such as filesByLocators, including the File id in the response.

Example

Query

query filesByLocators($locators: [FileLocatorInput!]!) {
filesByLocators(locators: $locators) {
id
}
}

Variables

{
"locators": [
{
"type": "S3FileLocator",
"bucket": "my-bucket",
"key": "example/path/my-file.mov"
},
{
"type": "S3FileLocator",
"bucket": "my-bucket",
"key": "example/path/my-other-file.mov"
}
]
}

Response

{
"data": {
"filesByLocators": [
{
"id": "f63a3849-3cf3-4835-be33-6743af08747c"
},
{
"id": "6ff1ee7d-d1e6-429b-81cd-0d07ea42bc9b"
}
]
}
}

Inserting a single Ad Break

After obtaining the internal file IDs, you can insert ad breaks one at a time by using the createAdBreak mutation.

Example

Mutation

mutation CreateAdBreak($input: AdBreakInput!) {
createAdBreak(input: $input) {
id
fileId
timecode
description
}
}

Variables

{
"input": {
"fileId": "f63a3849-3cf3-4835-be33-6743af08747c",
"timecode": "00:01:20:15",
"description": "Ad break 1"
}
}

Response

{
"data": {
"createAdBreak": {
"id": "3e137ef5-e64a-46ce-9fb8-6d3d6f850a0a",
"fileId": "f63a3849-3cf3-4835-be33-6743af08747c",
"timecode": "00:01:20:15",
"description": "Ad break 1"
},
}
}

Inserting Ad Breaks in Bulk

To insert or update multiple ad breaks in bulk, you can use the bulkUpsertAdBreaks mutation to either insert or update multiple ad breaks for each file.

Example:

Mutation

mutation BulkUpsertAdBreaks($input: [AdBreakInput!]!) {
bulkUpsertAdBreaks(data: $input) {
id
fileId
timecode
description
}
}

Variables

{
"input": [
{
"fileId": "f63a3849-3cf3-4835-be33-6743af08747c",
"timecode": "00:01:20:15",
"description": "Ad break 1"
},
{
"fileId": "f63a3849-3cf3-4835-be33-6743af08747c",
"timecode": "00:05:15:00",
"description": "Ad break 2"
},
{
"fileId": "6ff1ee7d-d1e6-429b-81cd-0d07ea42bc9b",
"timecode": "00:02:06:20",
"description": "Ad break 1"
}
]
}

Response

{
"data": {
"bulkUpsertAdBreaks": [
{
"id": "3e137ef5-e64a-46ce-9fb8-6d3d6f850a0a",
"fileId": "f63a3849-3cf3-4835-be33-6743af08747c",
"timecode": "00:01:20:15",
"description": "Ad break 1"
},
{
"id": "ed033cb2-7ac4-465e-b5f1-067fe473f29e",
"fileId": "f63a3849-3cf3-4835-be33-6743af08747c",
"timecode": "00:05:15:00",
"description": "Ad break 2"
},
{
"id": "b24e5c7d-e9de-419f-8aea-2e3be4018c75",
"fileId": "6ff1ee7d-d1e6-429b-81cd-0d07ea42bc9b",
"timecode": "00:02:06:20",
"description": "Ad break 1"
}
]
}
}

Getting Ad Breaks

You can list the ad breaks for a specific file using the adBreaks query.

Example

Query

query AdBreaks($filters: AdBreakFilters) {
adBreaks(filters: $filters) {
edges {
node {
id
fileId
timecode
description
}
}
}
}

Variables

{
"filters": {
"fileId": {
"eq": "f63a3849-3cf3-4835-be33-6743af08747c"
}
}
}

Response

{
"data": {
"adBreaks": {
"edges": [
{
"node": {
"id": "3e137ef5-e64a-46ce-9fb8-6d3d6f850a0a",
"fileId": "f63a3849-3cf3-4835-be33-6743af08747c",
"timecode": "00:01:20:15",
"description": "Ad break 1"
}
}
]
}
}
}

Updating a Single Ad Break

You can update the time code or description of an existing ad break using the updateAdBreak mutation.

Example

Mutation

mutation UpdateAdBreak($id: ID!, $input: AdBreakInput!) {
updateAdBreak(id: $id, input: $input) {
id
timecode
description
}
}

Variables

{
"id": "3e137ef5-e64a-46ce-9fb8-6d3d6f850a0a",
"input": {
"description": "New description"
}
}

Response

{
"data": {
"updateAdBreak": {
"id": "3e137ef5-e64a-46ce-9fb8-6d3d6f850a0a",
"timecode": "00:01:20:15",
"description": "New description"
}
}
}

Deleting a Single Ad Break

To delete an ad break, you can use the deleteAdBreak mutation.

Example

Mutation

mutation DeleteAdBreak($id: ID!) {
deleteAdBreak(id: $id) {
id
}
}

Variables

{
"id": "3e137ef5-e64a-46ce-9fb8-6d3d6f850a0a"
}

Response

{
"data": {
"deleteAdBreak": null
}
}

Deleting Ad Breaks in Bulk

To delete multiple ad breaks at once, you can use the deleteAdBreaks mutation.

Example

Mutation

mutation DeleteAdBreaks($ids: [ID!]!) {
deleteAdBreaks(ids: $ids) {
id
}
}

Variables

{
"ids": [
"3e137ef5-e64a-46ce-9fb8-6d3d6f850a0a",
"ed033cb2-7ac4-465e-b5f1-067fe473f29e"
]
}

Response

{
"data": {
"deleteAdBreaks": null
}
}
MarkersMarkers