VideoController
Summary
Defines a controller to handle actions relative to videos' routes.
Constructor
VideoController
Syntax
VideoController
()
Summary
Item Index
Methods
- addEntitiesAction
- addEntityAction
- convertPoiAction
- displayVideoAction
- getAnonymousId
- getEntitiesAction
- getEntityAction
- getPlatformsAction
- getProvider
- getPublishManager
- getSuperAdminId
- getVideoReadyAction
- isUserManager
- publishVideosAction
- removeChaptersAction
- removeEntitiesAction
- removeTagsAction
- retryVideosAction
- startUploadAction
- unpublishVideosAction
- updateChapterAction
- updateEntityAction
- updateTagAction
Methods
addEntitiesAction
Syntax
addEntitiesAction
-
request
-
response
-
next
Summary
Adds medias.
It is not possible to add several medias at a time.
addEntityAction
Syntax
addEntityAction
-
request
-
response
-
next
Summary
Adds a media.
Parameters:
-
request
RequestExpressJS HTTP Request
-
body
ObjectThe media information as multipart body
-
[file]
Object optionalThe media file as multipart data -
[thumbnail]
Object optionalThe media thumbnail as multipart data -
info
ObjectThe media information -
info.title
StringThe media title -
[info.properties]
Object optionalThe media custom properties values with property id as keys -
[info.category]
String optionalThe media category id it belongs to -
[info.date]
Date | Number | String optionalThe media date -
[info.leadParagraph]
String optionalThe media lead paragraph -
[info.description]
String optionalThe media description -
[info.groups]
Array optionalThe media content groups it belongs to -
[info.platform]
String optionalThe platform to upload the file to
-
-
-
response
ResponseExpressJS HTTP Response
-
next
FunctionFunction to defer execution to the next registered middleware
convertPoiAction
Syntax
convertPoiAction
-
request
-
response
-
next
Summary
Converts points of interest (chapters, tags & cut) units from percents to milliseconds (depending on the video duration).
Parameters:
Example:
// Response example
{
"entity": ...
}
displayVideoAction
Syntax
displayVideoAction
-
request
-
response
-
next
Summary
Displays video player template.
Checks first if the video id is valid and if the video is published before returning the template.
getAnonymousId
Syntax
Summary
Gets the id of the anonymous user.
Returns:
The id of the anonymous user
getEntitiesAction
Syntax
getEntitiesAction
-
request
-
response
-
next
Summary
Gets medias.
Parameters:
-
request
RequestExpressJS HTTP Request
-
query
ObjectRequest's query parameters
-
[query]
String optionalTo search on both medias title and description -
[include]
String | Array optionalThe list of fields to include from returned medias -
[exclude]
String | Array optionalThe list of fields to exclude from returned medias. Ignored if include is also specified. -
[states]
String | Array optionalTo filter medias by state -
[dateStart]
String optionalTo filter medias after or equal to a date (in format mm/dd/yyyy) -
[dateEnd]
String optionalTo get medias before a date (in format mm/dd/yyyy) -
[categories]
String | Array optionalTo filter medias by category -
[groups]
String | Array optionalTo filter medias by group -
[user]
String | Array optionalTo filter medias by user -
[sortBy="date"]
String optionalTo sort medias by either **title**, **description**, **date**, **state**, **views** or **category** -
[sortOrder="desc"]
String optionalSort order (either **asc** or **desc**) -
[page=0]
String optionalThe expected page -
[limit=10]
String optionalTo limit the number of medias per page -
[properties]
Object optionalA list of properties with the property id as the key and the expected property value as the value
-
-
-
response
ResponseExpressJS HTTP Response
-
next
FunctionFunction to defer execution to the next registered middleware
Example:
// Response example
{
"entities" : [ ... ],
"pagination" : {
"limit": ..., // The limit number of medias by page
"page": ..., // The actual page
"pages": ..., // The total number of pages
"size": ... // The total number of medias
}
getEntityAction
Syntax
getEntityAction
-
request
-
response
-
next
Summary
Gets a media.
Parameters:
Example:
// Response example
{
"entity" : {
"id": ..., // The media id
"state": ..., // The media state
"date": ..., // The media published date as a timestamp
"type": ..., // The video associated platform
"errorCode": ..., // The media error code or -1 if no error
"category": ..., // The media category
"properties": {...}, // The media custom properties
"link": ..., // The media URL
"mediaId": [...], // The media id on the video platform
"available": ..., // The media availability on the video platform
"thumbnail": ..., // The media thumbnail URL
"title": ..., // The media title
"leadParagraph": ..., // The media lead paragraph
"description": ..., // The media description
"chapters": [...], // The media chapters
"tags": [...], // The media tags
"cut": [...], // The media begin and end cuts
"timecodes": [...], // The media associated images
}
}
getPlatformsAction
Syntax
getPlatformsAction
-
request
-
response
-
next
Summary
Gets all media platforms available.
Parameters:
Example:
{
"platforms" : [
...
]
}
getProvider
Syntax
Summary
Gets an instance of the controller associated provider.
Returns:
The provider
getPublishManager
Syntax
Summary
Gets PublishManager singleton.
Returns:
The PublishManager singleton
getSuperAdminId
Syntax
Summary
Gets the id of the super administrator.
Returns:
The id of the super admin
getVideoReadyAction
Syntax
getVideoReadyAction
-
request
-
response
-
next
Summary
Gets a ready media.
A ready media is a media with a state set to ready or published. Connected users may have access to ready medias but unconnected users can only access published medias.
Parameters:
Example:
// Response example
{
"entity" : {
"id": ..., // The media id
"state": ..., // The media state
"date": ..., // The media published date as a timestamp
"type": ..., // The video associated platform
"errorCode": ..., // The media error code or -1 if no error
"category": ..., // The media category
"properties": {...}, // The media custom properties
"link": ..., // The media URL
"mediaId": [...], // The media id on the video platform
"available": ..., // The media availability on the video platform
"thumbnail": ..., // The media thumbnail URL
"title": ..., // The media title
"leadParagraph": ..., // The media lead paragraph
"description": ..., // The media description
"chapters": [...], // The media chapters
"tags": [...], // The media tags
"cut": [...], // The media begin and end cuts
"timecodes": [...], // The media associated images
}
}
isUserManager
Syntax
Summary
Tests if user is a contents manager.
A contents manager can perform CRUD operations on medias.
Returns:
true if the user has permission to manage medias, false otherwise
publishVideosAction
Syntax
publishVideosAction
-
request
-
response
-
next
Summary
Publishes medias.
Change the state of medias to published.
Parameters:
Example:
// Response example
{
"total": 42
}
removeChaptersAction
Syntax
removeChaptersAction
-
request
-
response
-
next
Summary
Removes chapters from a media.
Parameters:
Example:
// Response example
{
"total": 1
}
removeEntitiesAction
Syntax
removeEntitiesAction
-
request
-
response
-
next
Summary
Removes medias.
User must have permission to remove the medias. If user doesn't have permission to remove a particular media an HTTP forbidden error will be sent as response. Only medias in a stable state can be removed.
Parameters:
Example:
// Response example
{
"total": 42
}
removeTagsAction
Syntax
removeTagsAction
-
request
-
response
-
next
Summary
Removes tags from a media.
Parameters:
Example:
// Response example
{
"total": 1
}
retryVideosAction
Syntax
retryVideosAction
-
request
-
response
-
next
Summary
Retries to publish videos on error.
startUploadAction
Syntax
startUploadAction
-
request
-
response
-
next
Summary
Starts uploading videos to the media platform.
Parameters:
unpublishVideosAction
Syntax
unpublishVideosAction
-
request
-
response
-
next
Summary
Unpublishes medias.
Change the state of medias to unpublished.
Parameters:
Example:
// Response example
{
"total": 42
}
updateChapterAction
Syntax
updateChapterAction
-
request
-
response
-
next
Summary
Updates a chapter associated to the given media.
If chapter does not exist it is created.
Parameters:
Example:
// Response example
{
"total": 1,
"chapter": ...
}
updateEntityAction
Syntax
updateEntityAction
-
request
-
response
-
next
Summary
Updates a media.
Parameters:
-
request
RequestExpressJS HTTP Request
-
params.id
StringId of the media to update
-
body
ObjectThe media information as multipart body
-
[thumbnail]
Object optionalThe media thumbnail as multipart data -
info
ObjectThe media information -
[info.title]
String optionalThe media title -
[info.properties]
Object optionalThe media custom properties values with property id as keys -
[info.category]
String optionalThe media category id it belongs to -
[info.date]
Date | Number | String optionalThe media date -
[info.leadParagraph]
String optionalThe media lead paragraph -
[info.description]
String optionalThe media description -
[info.groups]
Array optionalThe media content groups it belongs to
-
-
-
response
ResponseExpressJS HTTP Response
-
next
FunctionFunction to defer execution to the next registered middleware
Example:
// Response example
{
"total": 1
}
updateTagAction
Syntax
updateTagAction
-
request
-
response
-
next
Summary
Updates a tag associated to the given media.
If tag does not exist it is created.
Parameters:
Example:
// Response example
{
"total": 1,
"tag": ...
}