Example Scenario: MediaVault API
In this scenario, we imagine a server that exposes a media library over the network. When connecting to your own source, you would replace these endpoints with the real ones.
API
GET /api/root
Returns the top-level categories or folders.
json
{
"folders": [
{ "name": "Movies", "path": "/movies" },
{ "name": "TV Shows", "path": "/tv" }
]
}GET /api/browse?path=<path>
Returns the contents of a specific folder.
json
{
"folders": [
{ "name": "Action", "path": "/movies/action" }
],
"files": [
{
"name": "Big Buck Bunny.mp4",
"path": "/movies/big-buck-bunny.mp4",
"mimeType": "video/mp4"
}
]
}GET /api/stream?path=<path>
Returns the direct link to the media file bytes.
Content-Type: video/mp4Next Steps
Now that we have defined our API, we can proceed to Create a Plugin to map these responses to AN Player.