Documentation / Library Reference

The Echove Library Reference provides information on all available methods and all possible error responses.

The Echove PHP library contains four primary sections for helping you build your application. Core methods directly interact with the Echove class, Read methods correspond to Brightcove API read methods, Write methods correspond to Brightcove API write methods, and Convenience methods are available to help you convert returned data into a useful type for PHP.

Core Methods

__construct

Summary

The constructor for the Echove class.

Arguments

NameDefaultTypeDescription
token_readNULLStringThe read API token for the Brightcove account
token_writeNULLStringThe write API token for the Brightcove account

Properties

NameAccessTypeDescription
page_numberPublicIntegerThe value of the last 'page_number' return
page_sizePublicIntegerThe value of the last 'page_size' return
total_countPublicIntegerThe value of the last 'total_count' return
api_callsPrivateIntegerThe total number of API calls that have been processed
bit32PrivateBooleanWhether Echove is operating in 32-bit compatibility mode
media_deliveryPrivateStringWhat type of URL to return for UDS assets
securePrivateBooleanWhether Echove is operating over HTTPS
show_noticesPrivateBooleanWhether Echove will send error notices
timeout_attemptsPrivateIntegerThe number of times to retry a call in case of API timeout
timeout_currentPrivateIntegerThe current API timeout retry attempt
timeout_delayPrivateIntegerNumber of seconds to delay retry attempts
timeout_retryPrivateBooleanWhether to automatically retry calls that fail due to API timeout
token_readPrivateStringThe read Brightcove token to use
token_writePrivateStringThe write Brightcove token to use
url_readPrivateStringThe Brightcove Read API URL
url_writePrivateStringThe Brightcove Write API URL
valid_typesPrivateArrayAn array of valid object / media asset types

__set

Summary

Sets a property of the Echove class.

Arguments

NameTypeDescription
keyStringThe property to set
valueMixedThe new value for the property

Return

TypeDescription
MixedThe new value of the property

__get

Summary

Retrieves a property of the Echove class.

Arguments

NameTypeDescription
keyStringThe property to retrieve

Return

TypeDescription
MixedThe value of the property

Read Methods

find

Summary

Formats the request for any API "Find" methods and retrieves the data.

The requested call may be written in a shortened version (e.g. "allVideos" or "all_videos" instead of "find_all_videos").

If the call supports get_item_count, it is defaulted to TRUE.

Arguments

NameDefaultTypeDescription
callStringThe requested API method
paramsNULLMixedA key-value array of API parameters, or a single value that matches the default

Return

TypeDescription
ObjectAn object containing all API return data

findAll

Summary

Finds all media assets in account, ignoring pagination.

This method should be used with extreme care as accounts with a large library of assets will require a high number of API calls. This could significantly affect performance and may result in additional charges from Brightcove.

Arguments

NameDefaultTypeDescription
typevideoStringThe type of object to retrieve
paramsNULLArrayA key-value array of API parameters

Return

TypeDescription
ObjectAn object containing all API return data

search

Summary

Performs a search of video meta data

Arguments

NameDefaultTypeDescription
typevideoStringThe type of objects to retrieve
termsNULLArrayThe terms to use for the search
paramsNULLMixedA key-value array of API parameters

Return

TypeDescription
ObjectAn object containing all API return data

Write Methods

createMedia

Summary

Uploads a media asset file to Brightcove.

When creating an asset from an upload it is suggested that you first move the file out of the temporary directory where PHP placed it and rename the file to it's original name.

An asset name and short description are both required; leaving these values blank will cause them to be populated with the current UNIX timestamp.

Certain upload settings are not allowed depending upon what default have already been set, and depending on the type of file being uploaded. Setting the incorrect values for these parameters will trigger a notice.

Arguments

NameDefaultTypeDescription
typevideoStringThe type of object to upload
fileNULLStringThe location of the temporary file
metaArrayThe media asset information
optionsNULLArrayOptional upload values

Return

TypeDescription
IntegerThe media asset ID

createPlaylist

Summary

Creates a playlist.

Arguments

NameDefaultTypeDescription
typevideoStringThe type of playlist to create
metaArrayThe playlist information

Return

TypeDescription
MixedThe playlist ID

update

Summary

Updates a media asset.

Only the meta data that has changed needs to be passed along. Be sure to include the asset ID, though.

Arguments

NameDefaultTypeDescription
typevideoStringThe type of object to update
metaArrayThe information for the media asset

Return

TypeDescription
DTOThe new DTO

createImage

Summary

Uploads a media image file to Brightcove.

When creating an image it is suggested that you first move the file out of the temporary directory where PHP placed it and rename the file to it's original name.

Arguments

NameDefaultTypeDescription
typevideoStringThe type of object to upload image for
fileNULLStringThe location of the temporary file
metaArrayThe image information
idNULLIntegerThe ID of the media asset to assign the image to
ref_idNULLStringThe reference ID of the media asset to assign the image to
resizeTRUEBooleanWhether or not to resize the image on upload

Return

TypeDescription
MixedThe image asset

createOverlay

Summary

Uploads a logo overlay file to Brightcove.

When creating a logo overlay it is suggested that you first move the file out of the temporary directory where PHP placed it and rename the file to it's original name.

Arguments

NameDefaultTypeDescription
fileNULLStringThe location of the temporary file
metaArrayThe logo overlay information
idNULLIntegerThe ID of the media asset to assign the logo overlay to
ref_idNULLStringThe reference ID of the media asset to assign the logo overlay to

Return

TypeDescription
MixedThe logo overlay asset

deleteOverlay

Summary

Deletes a logo overlay.

Arguments

NameDefaultTypeDescription
idNULLIntegerThe ID of the media asset
ref_idNULLStringThe reference ID of the media asset
optionsNULLArrayOptional values

delete

Summary

Deletes a media asset.

Either an ID or Reference ID must be passed.

Arguments

NameDefaultTypeDescription
typevideoStringThe type of item to delete
idNULLIntegerThe ID of the media asset
ref_idNULLStringThe reference ID of the media asset
optionsNULLArrayOptional values

getStatus

Summary

Retrieves the status of a media asset upload.

Arguments

NameDefaultTypeDescription
typevideoStringThe type of object to check
idNULLStringThe ID of the media asset
ref_idTRUEStringThe reference ID of the media asset

Return

TypeDescription
StringThe upload status

shareMedia

Summary

Shares a media asset with the selected accounts.

Sharing must be enabled between the two accounts.

Arguments

NameDefaultTypeDescription
typevideoStringThe type of object to share
idIntegerThe ID of the media asset
account_idsArrayAn array of account IDs
acceptFALSEBooleanWhether the share should be auto accepted
forceFALSEBooleanWhether the share should overwrite existing copies of the media

Return

TypeDescription
ArrayThe new media asset IDs

removeFromPlaylist

Summary

Removes assets from a playlist.

Arguments

NameTypeDescription
playlist_idIntegerThe ID of the playlist to modify
video_idsArrayAn array of video IDs to delete from the playlist

Return

TypeDescription
ArrayThe new playlist DTO

addToPlaylist

Summary

Adds assets to a playlist.

Arguments

NameTypeDescription
playlist_idIntegerThe ID of the playlist to modify
video_idsArrayAn array of video IDs to add to the playlist

Return

TypeDescription
ArrayThe new playlist DTO

Convenience Methods

time

Summary

Converts milliseconds to formatted time or seconds.

Arguments

NameDefaultTypeDescription
msIntegerThe length of the media asset in milliseconds
secondsFALSEBooleanWhether to return only seconds

Return

TypeDescription
MixedThe formatted length or total seconds of the media asset

tags

Summary

Parses media asset tags array into a key-value array.

Arguments

NameDefaultTypeDescription
tagsArrayThe tags array from a media asset DTO
implodeFALSEBooleanReturn array to Brightcove format

Return

TypeDescription
MixedA key-value array of tags, or a comma-separated string

filter

Summary

Removes assets that don't contain the appropriate tags.

Arguments

NameDefaultTypeDescription
videosArrayAll the assets you wish to filter
tagStringA comma-separated list of tags to filter on

Return

TypeDescription
ArrayThe filtered list of assets

sef

Summary

Formats a media asset name to be search-engine friendly.

Arguments

NameDefaultTypeDescription
nameStringThe asset name

Return

TypeDescription
StringThe search-engine friendly asset name

Errors

EchoveApiError

Summary

This is the most generic error returned from Echove as it is thrown whenever the API returns unexpected data, or an error. The API return data will be included in the error to help you diagnose the problem.

EchoveDeprecated

Summary

The requested item is no longer supported by Brightcove and/or Echove. Stop using this method as early as possible, as the item could be removed in any future release.

EchoveDtoDoesNotExist

Summary

The specified asset does not exist in the Brightcove system. Ensure you're using the correct ID.

EchoveIdNotProvided

Summary

An ID has not been passed to the method (usually a "delete" or "share" function). Include the ID parameter to resolve the error.

EchoveInvalidFileType

Summary

The file being passed to the function is not supported. Try another file type to resolve the error.

EchoveInvalidMethod

Summary

The "find" method being requested is not supported by Echove, or does not exist in the Brightcove API. Remove the method call and check both the Echove and Brightcove API documentation.

EchoveInvalidProperty

Summary

The Echove property you are trying to set or retrieve does not exist. Check the Echove documentation.

EchoveInvalidType

Summary

The DTO type (video, playlist, image, etc) you specified is not allowed for the method. Check both the Echove and Brightcove API documentation.

EchoveSearchTermsNotProvided

Summary

Please specify one or more search parameters. Verify you are passing the parameters in an array.

EchoveTokenError

Summary

The read or write token you provided is not recognized by Brightcove. Verify you are using the correct token.

EchoveTransactionError

Summary

The API could not be accessed, or the API did not return any data. Verify the server has cURL installed, enabled, and able to retrieve remote data. Verify the Brightcove API is currently available.