VideoProvider
Summary
Defines a VideoProvider to get and save videos.
Constructor
VideoProvider
Syntax
VideoProvider
-
database
Summary
Parameters:
-
database
DatabaseThe database to interact with
Item Index
Methods
- add
- createIndexes
- getOne
- getTagFilePath
- remove
- removeAllDataRelatedToVideo
- removeChapters
- removeDirectories
- removeTags
- updateCategory
- updateDate
- updateErrorCode
- updateLastState
- updateLastTransition
- updateLink
- updateMedia
- updateMediaId
- updateMetadata
- updateOne
- updateOneChapter
- updateOneTag
- updateState
- updateThumbnail
- updateTitle
- updateType
Properties
Methods
add
Syntax
add
-
medias
-
[callback]
Summary
Adds medias.
Parameters:
-
medias
ArrayThe list of medias to store with for each media:
- String id The media id
- Boolean [available] true if the media is available, false otherwise
- String [title] The media title
- String [leadParagraph] The media lead paragraph
- String [description] The media description
- Number [state] The media state (see STATES class from module packages)
- Date [date] The media date
- String [type] The id of the associated media platform
- Object [metadata] Information about the media as a content
- String [metadata.user] The id of the user the media belongs to
- Array [metadata.groups] The list of groups the media belongs to
- Number [errorCode] The media error code (see ERRORS class from module packages)
- String [category] The id of the category the media belongs to
- Array [properties] The list of properties values for this media
- String [packageType] The type of package
- String [lastState] The last media state in publication process
- String [lastTransition] The last media transition in publication process
- String [originalPackagePath] Absolute path of the original package
- String [originalFileName] Original package name without the extension
- Array [mediaId] The list of medias in the media platform. Could have several media ids if media has multiple sources
- Array [timecodes] The list of media timecodes
- Array [chapters] The list of media chapters
- Array [tags] The list of media tags
- Array [cut] Media begin and end cuts
- Array [sources] The list of media sources
- Number [views=0] The statistic number of views
- String [thumbnail] The media thumbnail URI
- String [link] The media link in OpenVeo
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number The total amount of medias inserted
- Array The list of added medias
createIndexes
Syntax
createIndexes
-
callback
Summary
Creates videos indexes.
Parameters:
-
callback
FunctionFunction to call when it's done with :
- Error An error if something went wrong, null otherwise
getOne
Syntax
getOne
-
[filter]
-
[fields]
-
callback
Summary
Fetches a media.
If filter corresponds to more than one media, the first found media will be the returned one. If the media point of interests are in percents, needPointsOfInterestUnitConversion property will be added to the media.
Parameters:
-
[filter]
ResourceFilter optionalRules to filter medias
-
[fields]
Object optionalFields to be included or excluded from the response, by default all fields are returned. Only "exclude" or "include" can be specified, not both
-
callback
FunctionThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Object The media
getTagFilePath
Syntax
Summary
Resolves media tag file path.
Parameters:
Returns:
The resolved file path
remove
Syntax
remove
-
[filter]
-
[callback]
Summary
Removes medias.
All datas associated to the deleted medias will also be deleted.
Parameters:
-
[filter]
ResourceFilter optionalRules to filter medias to remove
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number The number of removed medias
removeAllDataRelatedToVideo
Syntax
removeAllDataRelatedToVideo
-
videosToRemove
-
callback
Summary
Removes all data related to a list of videos.
removeChapters
Syntax
removeChapters
-
[filter]
-
chaptersIds
-
[callback]
Summary
Removes chapters associated to a media.
removeDirectories
Syntax
removeDirectories
-
directories
-
callback
Summary
Removes a list of directories.
removeTags
Syntax
removeTags
-
[filter]
-
tagsIds
-
[callback]
Summary
Removes tags associated to a media.
Files associated to deleted tags are also removed.
updateCategory
Syntax
updateCategory
-
id
-
category
-
callback
Summary
Updates video category for video platform.
updateDate
Syntax
updateDate
-
id
-
date
-
callback
Summary
Updates video date timestamp.
updateErrorCode
Syntax
updateErrorCode
-
id
-
errorCode
-
callback
Summary
Updates video error code.
updateLastState
Syntax
updateLastState
-
id
-
state
-
callback
Summary
Updates last video state.
updateLastTransition
Syntax
updateLastTransition
-
id
-
state
-
callback
Summary
Updates last video transition.
updateLink
Syntax
updateLink
-
id
-
link
-
callback
Summary
Updates video link.
updateMedia
Syntax
updateMedia
-
id
-
modifier
-
[callback]
Summary
Executes an update operation on the given media.
Only one update operation can be performed at a time. Pending operations are added to the queue and executed sequentially.
updateMediaId
Syntax
updateMediaId
-
id
-
idMediaPlatform
-
callback
Summary
Updates media id for media platform.
updateMetadata
Syntax
updateMetadata
-
id
-
metadata
-
callback
Summary
Updates video metadata for video platform.
updateOne
Syntax
updateOne
-
[filter]
-
data
-
[callback]
Summary
Updates a media.
Parameters:
-
[filter]
ResourceFilter optionalRules to filter the media to update
-
data
ObjectThe modifications to perform
- String [data.title] The media title
- Date [data.date] The media date
- String [data.leadParagraph] The media lead paragraph
- String [data.description] The media description
- Array [data.properties] The list of properties values for this media
- String [data.category] The id of the category the media belongs to
- Array [data.cut] Media begin and end cuts
- Array [data.timecodes] The list of media timecodes
- Array [data.chapters] The list of media chapters
- Array [data.tags] The list of media tags
- Number [data.views=0] The statistic number of views
- String [data.thumbnail] The media thumbnail URI
- Array [data.sources] The list of media sources
- Array [data.groups] The list of groups ids the media belongs to
- String [data.user] The user id the media belongs to
- Boolean [available] true if the media is available, false otherwise
- Number [state] The media state (see STATES class from module packages)
- Date [date] The media date
- String [type] The id of the associated media platform
- Object [metadata] Information about the media as a content
- Number [errorCode] The media error code (see ERRORS class from module packages)
- String [packageType] The type of package
- String [lastState] The last media state in publication process
- String [lastTransition] The last media transition in publication process
- Array [mediaId] The list of medias in the media platform. Could have several media ids if media has multiple sources
- String [link] The media link in OpenVeo
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number 1 if everything went fine
updateOneChapter
Syntax
updateOneChapter
-
[filter]
-
chapter
-
String
-
[callback]
Summary
Updates a chapter associated to a media.
If chapter does not exist for the media it is created.
Parameters:
-
[filter]
ResourceFilter optionalRules to filter the media to update
-
chapter
ObjectThe chapter description object
-
String
Object[chapter.id] The chapter id
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number 1 if everything went fine
- Object The chapter
updateOneTag
Syntax
updateOneTag
-
[filter]
-
tag
-
String
-
[file]
-
[callback]
Summary
Updates a tag associated to a media.
If tag does not exist for the media it is created. The associated file replaces the old file.
Parameters:
-
[filter]
ResourceFilter optionalRules to filter the media to update
-
tag
ObjectThe tag description object
-
String
Object[tag.id] The tag id
-
[file]
Object optionalThe new file to associate to the tag
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number 1 if everything went fine
- Object The tag
updateState
Syntax
updateState
-
id
-
state
-
callback
Summary
Updates video state.
updateThumbnail
Syntax
updateThumbnail
-
id
-
path
-
callback
Summary
Updates video thumbnail.
updateTitle
Syntax
updateTitle
-
id
-
title
-
callback
Summary
Updates video title.
updateType
Syntax
updateType
-
id
-
type
-
callback
Summary
Updates video platform type.