[STORY] As a host, I want CBA Media URLs automatically resolve to the actual media file, when pasting into the import dialog
Parent: [Epic] CBA Media URL Resolver (aura#440 - closed)
The details below are not updated in a while, check the parent ticket for recent info.
The dialog should
- detect any CBA Media URL (e.g. ttps://cba.fro.at/623445)
- check against the CBA API
- use the actual CBA Media File URL
The logic is similar to what is done in the Play Web Components.
CBA API Request
You need
- CBA API Key: The play repo holds an demo key, which can be used for dev-purposes
- CBA Media ID: Extract that from the original URL
- CBA Allowed URLs: A list of CBA Domains which should be resolved (typicially: https://cba.fro.at/,
https://cba.media/,https://cba.yourradio.name). They can be stored in a textfield, next to the Radio Settings in Dashboard.
After that doing a fetch to https://cba.fro.at/wp-json/wp/v2/media?api_key=%API_KEY%&parent=%MEDIA_ID% returns an object holding the URL to the audio file:
{
...
source_url: "https://cba.fro.at/wp-content/uploads/9/5/0010587619/audio-filename.mp3"
}
Dependencies
Edited by David Trattnig
