Source
A source returned by craft.videoPicker.getSourceByHandle() is a Source object. Use it when custom integration code needs provider capabilities or needs to fetch a provider video directly. Templates that render a field selection normally work with a Video instead.
Finding Sources
Choose a lookup according to the information your template has:
craft.videoPicker.getAllSources()returns all saved Sources.craft.videoPicker.getAllEnabledSources()excludes disabled Sources.craft.videoPicker.getAllConfiguredSources()returns Sources with their required settings; OAuth Sources may still need to reconnect.craft.videoPicker.getSourceById(id)accepts an integer database ID.craft.videoPicker.getSourceByHandle(handle)accepts the configured string handle.
The collection methods return arrays of Source objects. For example, list enabled providers that are ready to use:
<ul>
{% for source in craft.videoPicker.getAllEnabledSources() %}
{% if source.isUsable() %}
<li>{{ source.name }}</li>
{% endif %}
{% endfor %}
</ul>
Properties
Type: string|null
The name of the source.
Type: string|null
The handle of the source.
Type: bool|null
Whether the source is enabled or not.
Type: string|null
The primary brand colour of the connected provider.
Type: string|null
The SVG icon of the source provider connected.
Type: string
The name of the source provider connected.
Methods
Returns: bool
Whether the source provider has been configured.
Returns: bool
Whether the source is connected (OAuth token) or ready (credentials saved).
Returns: bool
Whether the required settings and connection are ready for provider requests. This does not check enabled; check that property too when using a lookup that includes disabled Sources.
Returns: bool
Whether this source type offers a connection action. OAuth sources authorise an account; credential sources verify their API settings.
Returns: bool
Whether the explorer can list collections.
Returns: bool
Whether the explorer can search this provider.
Returns: array
Calls a provider browse method and returns a response array. Its videos key contains Video objects; nextPage contains the provider's pagination value when another page is available. An unavailable method can return an empty array.
method is a string matching a supported provider collection method. options may contain id, q or nextPage; unsupported keys are discarded. videosPerPage is an optional int from 1 to 50.
For a connected YouTube Source with the handle youTube, list the account's uploads:
{% set source = craft.videoPicker.getSourceByHandle('youTube') %}
{% set result = source and source.enabled and source.isUsable()
? source.getVideos('uploads', {}, 12)
: {} %}
<ul>
{% for video in result.videos ?? [] %}
<li><a href="{{ video.url }}">{{ video.title }}</a></li>
{% endfor %}
</ul>If result.nextPage is present, pass that value as nextPage in a subsequent call using the same method and collection options. Treat it as a provider value, not a page number.
Returns: verbb\videopicker\models\Video|null
Fetches a Video object by its string ID from this source.
Returns: string
Returns the HTML embed code for a string video ID. The options array may include provider intent such as autoplay, muted, loop, controls and start, iframe attributes, or additional query parameters.
Returns: string
Returns the embed URL for a string video ID with optional provider intent and query parameters.
Returns: array
Returns provider options derived from a Video's metadata, such as Vimeo's unlisted privacy hash. Video embed methods apply these automatically, beneath field defaults and explicit options. Custom providers extending Source can override this method when their players need metadata beyond the video ID.