Read Me: This documentation is for rtMedia 3.0. rtMedia is a successor of BuddyPress Media and is currently under development. Parts of this document may not be implemented in the code, yet. Not recommended for production environments.
Using the Upload API, any media file can be added to rtMedia for display elsewhere using the Media API. The uploader can be completely customized and custom upload/import methods can be added easily.
Accessing the API
The Upload API for rtMedia is accessible in multiple ways:
- Uploader Shortcode
- Uploader Template Tag
- Uploader Template System (not recommended)
- Hooks and Filters
- RESTful API
The Upload Endpoint
The Anywhere Uploader of the Upload API works via the upload endpoint. It is a good idea to start with an understanding of the endpoint.
Concepts and Definitions
The Upload API in rtMedia allows for seamless front-end media uploads and integration with rtMedia for WordPress, BuddyPress, and bbPress. Furthermore, it allows for complete customization and extension via addons.
The Upload API provides the following interactions:
- Adding additional fields in the default modes
- Adding a custom upload mode
- Directly uploading to the upload endpoint via REST
- Integration into form submissions
Adding Additional Fields in the Default Modes
rtmedia_before_{mode}_ui
rtmedia_after_{mode}_ui
Upload Modes
rtMedia ships with two default modes:
- file_upload For uploading media from user’s system
- link_input For adding media via URLs
Adding Custom Modes
A custom mode can be added using the filter.
Processing Custom Mode Input
The custom mode processing can be accessed at the action hook. The hook passes the rtMedia upload object, which can be used for further processing. After processing the input, rtMedia expects a well-formatted media object.
Note
The method required for uploading media is rtmedia_upload_media.