OpenVeo Publish server

API Docs for: 8.0.0
Show:

VideoController

Extends ContentController
Module: controllers

Summary

Defines a controller to handle actions relative to videos' routes.

Constructor

VideoController

Syntax

VideoController

()

Summary

Methods

addEntitiesAction

Syntax

addEntitiesAction

(
  • request
  • response
  • next
)
async

Summary

Adds medias.

It is not possible to add several medias at a time.

Parameters:

  • request Request

    ExpressJS HTTP Request

  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

addEntityAction

Syntax

addEntityAction

(
  • request
  • response
  • next
)
async

Summary

Adds a media.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • body Object

      The media information as multipart body

      • [file] Object optional
        The media file as multipart data
      • [thumbnail] Object optional
        The media thumbnail as multipart data
      • info Object
        The media information
      • info.title String
        The media title
      • [info.properties] Object optional
        The media custom properties values with property id as keys
      • [info.category] String optional
        The media category id it belongs to
      • [info.date] Date | Number | String optional
        The media date
      • [info.leadParagraph] String optional
        The media lead paragraph
      • [info.description] String optional
        The media description
      • [info.groups] Array optional
        The media content groups it belongs to
      • [info.platform] String optional
        The platform to upload the file to
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

convertPoiAction

Syntax

convertPoiAction

(
  • request
  • response
  • next
)
async

Summary

Converts points of interest (chapters, tags & cut) units from percents to milliseconds (depending on the video duration).

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request parameters

      • id String
        The media id
      • chaptersIds String
        A comma separated list of chapters ids to remove
    • body String

      Information to convert points of interest

      • duration Number
        The media duration in milliseconds
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "entity": ...
}

displayVideoAction

Syntax

displayVideoAction

(
  • request
  • response
  • next
)
async

Summary

Displays video player template.

Checks first if the video id is valid and if the video is published before returning the template.

Parameters:

  • request Request

    ExpressJS HTTP Request

  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

getAnonymousId

Syntax

getAnonymousId

() String

Summary

Gets the id of the anonymous user.

Returns:

String:

The id of the anonymous user

getEntitiesAction

Syntax

getEntitiesAction

(
  • request
  • response
  • next
)
async

Summary

Gets medias.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • query Object

      Request's query parameters

      • [query] String optional
        To search on both medias title and description
      • [include] String | Array optional
        The list of fields to include from returned medias
      • [exclude] String | Array optional
        The list of fields to exclude from returned medias. Ignored if include is also specified.
      • [states] String | Array optional
        To filter medias by state
      • [dateStart] String optional
        To filter medias after or equal to a date (in format mm/dd/yyyy)
      • [dateEnd] String optional
        To get medias before a date (in format mm/dd/yyyy)
      • [categories] String | Array optional
        To filter medias by category
      • [groups] String | Array optional
        To filter medias by group
      • [user] String | Array optional
        To filter medias by user
      • [sortBy="date"] String optional
        To sort medias by either **title**, **description**, **date**, **state**, **views** or **category**
      • [sortOrder="desc"] String optional
        Sort order (either **asc** or **desc**)
      • [page=0] String optional
        The expected page
      • [limit=10] String optional
        To limit the number of medias per page
      • [properties] Object optional
        A list of properties with the property id as the key and the expected property value as the value
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function 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
)
async

Summary

Gets a media.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request parameters

      • id String
        The id of the media to retrieve
    • query Object

      Request query

      • [include] String | Array optional
        The list of fields to include from returned media
      • [exclude] String | Array optional
        The list of fields to exclude from returned media. Ignored if include is also specified.
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

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
)
async

Summary

Gets all media platforms available.

Parameters:

  • request Request

    ExpressJS HTTP Request

  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

{
  "platforms" : [
    ...
  ]
}

getProvider

Syntax

getProvider

() VideoProvider

Summary

Gets an instance of the controller associated provider.

Returns:

VideoProvider:

The provider

getPublishManager

Syntax

getPublishManager

() PublishManager

Summary

Gets PublishManager singleton.

Returns:

PublishManager:

The PublishManager singleton

getSuperAdminId

Syntax

getSuperAdminId

() String

Summary

Gets the id of the super administrator.

Returns:

String:

The id of the super admin

getVideoReadyAction

Syntax

getVideoReadyAction

(
  • request
  • response
  • next
)
async

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:

  • request Request

    ExpressJS HTTP Request

  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

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

isUserManager

(
  • user
)
Boolean

Summary

Tests if user is a contents manager.

A contents manager can perform CRUD operations on medias.

Parameters:

  • user Object

    The user to test

    • permissions Array

      The user's permissions

Returns:

Boolean:

true if the user has permission to manage medias, false otherwise

publishVideosAction

Syntax

publishVideosAction

(
  • request
  • response
  • next
)
async

Summary

Publishes medias.

Change the state of medias to published.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request's parameters

      • ids String
        A comma separated list of media ids
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 42
}

removeChaptersAction

Syntax

removeChaptersAction

(
  • request
  • response
  • next
)
async

Summary

Removes chapters from a media.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request parameters

      • id String
        The media id
      • chaptersids String
        A comma separated list of chapters ids to remove
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 1
}

removeEntitiesAction

Syntax

removeEntitiesAction

(
  • request
  • response
  • next
)
async

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:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request parameters

      • id String
        A comma separated list of media ids to remove
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 42
}

removeTagsAction

Syntax

removeTagsAction

(
  • request
  • response
  • next
)
async

Summary

Removes tags from a media.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request parameters

      • id String
        The media id
      • tagsids String
        A comma separated list of tags ids to remove
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 1
}

retryVideosAction

Syntax

retryVideosAction

(
  • request
  • response
  • next
)
async

Summary

Retries to publish videos on error.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request's parameters

      • ids String
        Comma separated list of media ids
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

startUploadAction

Syntax

startUploadAction

(
  • request
  • response
  • next
)
async

Summary

Starts uploading videos to the media platform.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request's parameters

      • ids String
        Comma separated list of media ids
      • platform String
        The id of the platform to upload to
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

unpublishVideosAction

Syntax

unpublishVideosAction

(
  • request
  • response
  • next
)
async

Summary

Unpublishes medias.

Change the state of medias to unpublished.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request's parameters

      • ids String
        A comma separated list of media ids
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 42
}

updateChapterAction

Syntax

updateChapterAction

(
  • request
  • response
  • next
)
async

Summary

Updates a chapter associated to the given media.

If chapter does not exist it is created.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • [body] Object optional

      Request body

      • [info] Object optional
        Modifications to perform on the chapter
      • [info.value] Number optional
        The chapter time in milliseconds
      • [info.name] String optional
        The chapter name
      • [info.description] String optional
        The chapter description
    • params Object

      Request parameters

      • id String
        The media id the chapter belongs to
      • [chapterid] String optional
        The chapter id
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 1,
  "chapter": ...
}

updateEntityAction

Syntax

updateEntityAction

(
  • request
  • response
  • next
)
async

Summary

Updates a media.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params.id String

      Id of the media to update

    • body Object

      The media information as multipart body

      • [thumbnail] Object optional
        The media thumbnail as multipart data
      • info Object
        The media information
      • [info.title] String optional
        The media title
      • [info.properties] Object optional
        The media custom properties values with property id as keys
      • [info.category] String optional
        The media category id it belongs to
      • [info.date] Date | Number | String optional
        The media date
      • [info.leadParagraph] String optional
        The media lead paragraph
      • [info.description] String optional
        The media description
      • [info.groups] Array optional
        The media content groups it belongs to
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 1
}

updateTagAction

Syntax

updateTagAction

(
  • request
  • response
  • next
)
async

Summary

Updates a tag associated to the given media.

If tag does not exist it is created.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • [body] Object optional

      Request multipart body

      • [info] Object optional
        Modifications to perform on the tag
      • [info.value] Number optional
        The tag time in milliseconds
      • [info.name] String optional
        The tag name
      • [info.description] String optional
        The tag description
      • [file] String optional
        The multipart file associated to the tag
    • params Object

      Request's parameters

      • id String
        The media id the tag belongs to
      • [tagid] String optional
        The tag id
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 1,
  "tag": ...
}