Import the library and use the constructor:
$bstream = new BunnyCDNStream("YOUR_VIDEO_LIBRARY_ID", "YOUR_STREAM_ZONE_API_KEY");
Provided that the correct Video ID and Stream API key were used, this will return a JSON object containing the video object's metadata.
Exceptions are divided into HTTP status codes (and this applies to all methods):
- 401
- Your API key is invalid
- 404
- Either your library or video could not be found
It is safe to assume that if no exception is thrown, the video's information will be in the response JSON object.
While you can override the default values, this, by default, will provide the first 10 videos in your Stream zone.
You can also provide an optional "search" parameter to find videos, or look for videos in specific collections.
This will update a video's title and collection ID.
This will permanantly delete a video.
Creates a video object (this MUST BE DONE before calling uploadVideoWithId()
).
This will upload a video located at /path/to/your/video.mp4
to the video object located at $videoId
.
This will create a video object AND upload a video at $filePath
. Collection ID is optional.
Set the video thumbnail to an image at $thumbnailUrl
.
Fetch video from external source $source
and upload it to $videoId
.
You may optionally provide a key value pair to $headers
if your external source requires authentication.
Add a VRT captions file ($content
= the /path/to/file.vrt) to $videoId
.
While $label
is optional, it is highly recommended so users know what they're selecting.
Deletes a caption file from a video object (where video == $videoId
).
Make sure to specify the correct 2-letter language code.