The media controller is the endpoint for media related operations.
Uploading files
If you want to upload local files to AdmiralCloud please see S3 Controller. If you want to use URL upload, see section “Upload Media from URL” below.
Reference
Find Media
Returns all media for a given mediaContainerId. Only media with a valid fileSize (> 0) is returned. Response is always an array.
If a user does not have permission “media_downloadOriginal” storage information (bucket, s3key,…) of the original files are filtered out.
FindBatch Media
Returns a bunch of media items for the given mediacontainers.
If a user does not have permission “media_downloadOriginal” the original files are filtered out, even if the correct ids are sent.
Create Media
Creates a new media element. If you want a transcoding or upload, you have to initialize that separately using this media item. A new media with source “user” will always be created with formatId for “original” in order to make it available for public areas. Before creating the API will make a duplicate check based on mediacontainerId, formatId and optional subtitle.
If you want to REPLACE an original file, please create a media with usage “replacement”. Then you can initiate a classic upload – make sure to call s3.success to start the actual replacement. Or use media.upload to upload the replacement file from a URL. The user needs permission “media_replaceOriginal” in order to use this function.
Update Media
Updates a media element. This function should be used to set the usage of a media element.
Destroy Media
Deletes a media item (in the database as well as on the file system). If there are any transcodings active, these will be killed too.
Original Media cannot be deleted, only if the mediacontainer is deleted (with a retention period).
If a media is linked to multidownloads or public areas the user gets a warning. The media can still be deleted (and will be in all associated items) when * forceDelete is set. If a media is linked to a chapter (as preview image) the user gets a warning to and can use forceDelete for remove it anyways.
Upload Media from URL
Loads an (original) media file from a given URL. You must create a mediacontainer first.
Download Media
Returns a bunch of signed URLs for the given media ids. If the requested file is < 20 GB then it is delivered via CF otherwise directly via S3.
If one of the media is not available for the user, then it is silently removed from the list. If you send formatIds, then ids are interpreted as mediaContainerIds and the media ids are determined this way.
If a media has an error, then just the id, no signedUrl is returned for that item.
If you send more than 200 ids with one call, the API will truncate the response to 200 items and send a warning with an X-AdmiralCloud-Warning Header.
Please read the information of expiration date of links: Links in AdmiralCloud
Preview Image
Returns/Redirects to the current preview image for this mediacontainer. The response sets cache headers for 60 seconds.
TECH NOTE: Due to 307 the CDN needs to set a fixed cache time of 60 seconds.