Brightcove
The brightcove module lets editors search and import videos from a Brightcove Video Cloud account through Brightspot's federated search, and can incrementally import new and updated videos on a schedule.
Dependencies
Depends on db-http and the Brightcove CMS API v1 (cms.api.brightcove.com), authenticated with an OAuth2 client-credentials token from oauth.brightcove.com.
Installation
- Maven
- Gradle
- Gradle (Kotlin DSL)
<!-- Requires Brightspot 5.0 or later. -->
<dependency>
<groupId>com.brightspot.dbhttp</groupId>
<artifactId>brightcove</artifactId>
<version>1.0.0</version>
</dependency>
// Requires Brightspot 5.0 or later.
implementation 'com.brightspot.dbhttp:brightcove:1.0.0'
// Requires Brightspot 5.0 or later.
implementation("com.brightspot.dbhttp:brightcove:1.0.0")
API reference
com.psddev.brightcove.BrightcoveDatabase
Extends HttpDatabase. Builds a Brightcove CMS query string from the editor's keywords and an update-date range filter, and caches both search results and individual video lookups for five minutes to reduce API calls. Detail lookups are batched in groups of up to 10 video Ids, matching a limit in Brightcove's API.
com.psddev.brightcove.BrightcoveVideoExternalItem
Extends ExternalItem, displayed as Brightcove Video.
| Field | Type | Description |
|---|---|---|
previewUrl | String | A Brightcove Player embed URL used to preview the video in the CMS. |
brightcoveVideo | BrightcoveVideo | The embedded Brightcove video metadata (see below). |
updateDate | Date | When the video was last updated in Brightcove. Filterable in search. |
com.psddev.brightcove.BrightcoveVideo mirrors the Brightcove CMS API's video object, including brightcoveId, brightcoveName, description, longDescription, tags, customFields, cuePoints, duration, brightcoveState (ACTIVE/INACTIVE), publishedAt, createdAt, updatedAt, schedule, textTracks, folderId, sharing, and Brightspot-only poster/thumbnail (StorageItem).
Configuration
Each Brightcove account is configured as a com.psddev.brightcove.BrightcoveSettings record (accountId, playerId, clientId, clientSecret, taskHostName, importEnabled, fullImportEnabled, debugEnabled), collected into a Set<BrightcoveSettings> on BrightcoveSiteSettingsModification, shown under Site Settings > Integrations > Brightcove. A site can configure multiple Brightcove accounts.
When importEnabled is on, BrightcoveImportTask periodically imports new and updated videos in the background rather than waiting for an editor to search for them. taskHostName designates which application host runs the import so it doesn't run redundantly on every instance.
The Brightcove Player script is injected into the CMS automatically so imported videos preview inline using the account's configured playerId.
Extending the plugin
The module doesn't ship a content type for imported videos, and supports extension in both directions:
- Import. Extend
AbstractBrightcoveVideoImporter<T>and implementdoImportto map a Brightcove video into a local content type, for use with scheduled import. CallsetInitiatedByImportbefore saving sobeforeSave/afterSavehooks can detect that the update came from an import. - Export. Extend
AbstractBrightcoveVideoExporter<T>and implementdoExportto push a local content object's changes back to Brightcove.