YouTubePHP Documentation

CaptionSnippet extends Part
in package

This file is generated from spec/discovery.json (YouTube Data API v3, revision 20260924) by tools/generate.php. Do not edit it by hand - run `composer spec:build` instead.

Basic details about a caption track, such as its language and name.

Tags
since
1.0.0

Table of Contents

Constants

AUDIO_TRACK_TYPE_COMMENTARY  : mixed = 'commentary'
A `audioTrackType` of `commentary`.
AUDIO_TRACK_TYPE_DESCRIPTIVE  : mixed = 'descriptive'
A `audioTrackType` of `descriptive`.
AUDIO_TRACK_TYPE_PRIMARY  : mixed = 'primary'
A `audioTrackType` of `primary`.
AUDIO_TRACK_TYPE_UNKNOWN  : mixed = 'unknown'
A `audioTrackType` of `unknown`.
FAILURE_REASON_PROCESSING_FAILED  : mixed = 'processingFailed'
A `failureReason` of `processingFailed`.
FAILURE_REASON_UNKNOWN_FORMAT  : mixed = 'unknownFormat'
A `failureReason` of `unknownFormat`.
FAILURE_REASON_UNSUPPORTED_FORMAT  : mixed = 'unsupportedFormat'
A `failureReason` of `unsupportedFormat`.
STATUS_FAILED  : mixed = 'failed'
A `status` of `failed`.
STATUS_SERVING  : mixed = 'serving'
A `status` of `serving`.
STATUS_SYNCING  : mixed = 'syncing'
A `status` of `syncing`.
TRACK_KIND_ASR  : mixed = 'ASR'
A `trackKind` of `ASR`.
TRACK_KIND_FORCED  : mixed = 'forced'
A `trackKind` of `forced`.
TRACK_KIND_STANDARD  : mixed = 'standard'
A `trackKind` of `standard`.

Properties

$audioTrackType  : string|null
$failureReason  : string|null
$isAutoSynced  : bool|null
$isCC  : bool|null
$isDraft  : bool|null
$isEasyReader  : bool|null
$isLarge  : bool|null
$language  : string|null
$lastUpdated  : CarbonImmutable|null
$name  : string|null
$status  : string|null
$trackKind  : string|null
$videoId  : string|null
$casts  : array<string, string>
Attribute name => type token (`"LiveChatMessageSnippet"`, `"Array of Thumbnail"`, `"Map of VideoLocalization"`), used to hydrate nested objects into parts.
$dates  : array<int, string>
Attribute names holding RFC 3339 timestamps, read back as {@see CarbonImmutable}. They are stored and serialised as the strings YouTube sent.
$youtube  : ?YouTube

Methods

__construct()  : mixed
__debugInfo()  : array<string, mixed>
__get()  : mixed
__isset()  : bool
__set()  : void
__toString()  : string
__unset()  : void
attributeExists()  : bool
fill()  : void
getAttribute()  : mixed
getCasts()  : array<string, string>
getDates()  : array<int, string>
getRawAttribute()  : mixed
Reads straight from the attribute bag, skipping the `get{Key}Attribute` hook.
getRawAttributes()  : array<string, mixed>
getYouTube()  : YouTube
The client this part came from.
jsonSerialize()  : array<string, mixed>
The payload this part would be sent back to YouTube as: nested parts and collections flattened, timestamps as RFC 3339 strings.
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
setAttribute()  : void
factory()  : Factory
Builds another part from the same client - for nested objects.
setRawAttribute()  : void
Writes straight to the attribute bag, skipping the `set{Key}Attribute` hook and any cast. For use *inside* a mutator, which would otherwise have no way to store its shaped value without recursing through {@see setAttribute()}.

Constants

AUDIO_TRACK_TYPE_COMMENTARY

A `audioTrackType` of `commentary`.

public mixed AUDIO_TRACK_TYPE_COMMENTARY = 'commentary'

AUDIO_TRACK_TYPE_DESCRIPTIVE

A `audioTrackType` of `descriptive`.

public mixed AUDIO_TRACK_TYPE_DESCRIPTIVE = 'descriptive'

AUDIO_TRACK_TYPE_PRIMARY

A `audioTrackType` of `primary`.

public mixed AUDIO_TRACK_TYPE_PRIMARY = 'primary'

AUDIO_TRACK_TYPE_UNKNOWN

A `audioTrackType` of `unknown`.

public mixed AUDIO_TRACK_TYPE_UNKNOWN = 'unknown'

FAILURE_REASON_PROCESSING_FAILED

A `failureReason` of `processingFailed`.

public mixed FAILURE_REASON_PROCESSING_FAILED = 'processingFailed'

FAILURE_REASON_UNKNOWN_FORMAT

A `failureReason` of `unknownFormat`.

public mixed FAILURE_REASON_UNKNOWN_FORMAT = 'unknownFormat'

FAILURE_REASON_UNSUPPORTED_FORMAT

A `failureReason` of `unsupportedFormat`.

public mixed FAILURE_REASON_UNSUPPORTED_FORMAT = 'unsupportedFormat'

STATUS_FAILED

A `status` of `failed`.

public mixed STATUS_FAILED = 'failed'

STATUS_SERVING

A `status` of `serving`.

public mixed STATUS_SERVING = 'serving'

STATUS_SYNCING

A `status` of `syncing`.

public mixed STATUS_SYNCING = 'syncing'

TRACK_KIND_ASR

A `trackKind` of `ASR`.

public mixed TRACK_KIND_ASR = 'ASR'

TRACK_KIND_FORCED

A `trackKind` of `forced`.

public mixed TRACK_KIND_FORCED = 'forced'

TRACK_KIND_STANDARD

A `trackKind` of `standard`.

public mixed TRACK_KIND_STANDARD = 'standard'

Properties

$audioTrackType

public string|null $audioTrackType

The type of audio track associated with the caption track. One of the AUDIO_TRACK_TYPE_* constants.

$failureReason

public string|null $failureReason

The reason that YouTube failed to process the caption track. This property is only present if the state property's value is failed. One of the FAILURE_REASON_* constants.

$isAutoSynced

public bool|null $isAutoSynced

Indicates whether YouTube synchronized the caption track to the audio track in the video. The value will be true if a sync was explicitly requested when the caption track was uploaded. For example, when calling the captions.insert or captions.update methods, you can set the sync parameter to true to instruct YouTube to sync the uploaded track to the video. If the value is false, YouTube uses the time codes in the uploaded caption track to determine when to display captions.

$isCC

public bool|null $isCC

Indicates whether the track contains closed captions for the deaf and hard of hearing. The default value is false.

$isDraft

public bool|null $isDraft

Indicates whether the caption track is a draft. If the value is true, then the track is not publicly visible. The default value is false. @mutable youtube.captions.insert youtube.captions.update

$isEasyReader

public bool|null $isEasyReader

Indicates whether caption track is formatted for "easy reader," meaning it is at a third-grade level for language learners. The default value is false.

$isLarge

public bool|null $isLarge

Indicates whether the caption track uses large text for the vision-impaired. The default value is false.

$language

public string|null $language

The language of the caption track. The property value is a BCP-47 language tag.

$lastUpdated

public CarbonImmutable|null $lastUpdated

The date and time when the caption track was last updated.

$name

public string|null $name

The name of the caption track. The name is intended to be visible to the user as an option during playback.

$status

public string|null $status

The caption track's status. One of the STATUS_* constants.

$trackKind

public string|null $trackKind

The caption track's type. One of the TRACK_KIND_* constants.

$videoId

public string|null $videoId

The ID that YouTube uses to uniquely identify the video associated with the caption track. @mutable youtube.captions.insert

$casts

Attribute name => type token (`"LiveChatMessageSnippet"`, `"Array of Thumbnail"`, `"Map of VideoLocalization"`), used to hydrate nested objects into parts.

protected array<string, string> $casts = []

$dates

Attribute names holding RFC 3339 timestamps, read back as {@see CarbonImmutable}. They are stored and serialised as the strings YouTube sent.

protected array<int, string> $dates = ['lastUpdated']

Methods

__construct()

public __construct([YouTube|null $youtube = null ][, array<string, mixed>|object $attributes = [] ]) : mixed
Parameters
$youtube : YouTube|null = null

The client, for behaviour that calls the API.

$attributes : array<string, mixed>|object = []

__debugInfo()

public __debugInfo() : array<string, mixed>
Return values
array<string, mixed>

__get()

public __get(string $name) : mixed
Parameters
$name : string

__isset()

public __isset(string $name) : bool
Parameters
$name : string
Return values
bool

__set()

public __set(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed

__toString()

public __toString() : string
Return values
string

__unset()

public __unset(string $name) : void
Parameters
$name : string

attributeExists()

public attributeExists(string $key) : bool
Parameters
$key : string
Return values
bool

fill()

public fill(array<string, mixed> $attributes) : void
Parameters
$attributes : array<string, mixed>

getAttribute()

public getAttribute(string $key) : mixed
Parameters
$key : string

getCasts()

public getCasts() : array<string, string>
Return values
array<string, string>

getDates()

public getDates() : array<int, string>
Return values
array<int, string>

getRawAttribute()

Reads straight from the attribute bag, skipping the `get{Key}Attribute` hook.

public getRawAttribute(string $key) : mixed
Parameters
$key : string

getRawAttributes()

public getRawAttributes() : array<string, mixed>
Return values
array<string, mixed>

getYouTube()

The client this part came from.

public getYouTube() : YouTube
Tags
throws
LogicException

When the part was built without one.

Return values
YouTube

jsonSerialize()

The payload this part would be sent back to YouTube as: nested parts and collections flattened, timestamps as RFC 3339 strings.

public jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>

offsetExists()

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

offsetSet()

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

setAttribute()

public setAttribute(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

factory()

Builds another part from the same client - for nested objects.

protected factory() : Factory
Return values
Factory

setRawAttribute()

Writes straight to the attribute bag, skipping the `set{Key}Attribute` hook and any cast. For use *inside* a mutator, which would otherwise have no way to store its shaped value without recursing through {@see setAttribute()}.

protected setRawAttribute(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed
On this page

Search results