1. Go to this page and download the library: Download vaersaagod/bunnymate library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vaersaagod / bunnymate example snippets
'videoLibraries' => [
'default' => [
'id' => '$BUNNY_STREAM_LIBRARY_ID',
'apiKey' => '$BUNNY_STREAM_API_KEY',
'readOnlyApiKey' => '$BUNNY_STREAM_READONLY_KEY',
'hostname' => 'vz-xxxxxxxx-xxx.b-cdn.net',
// Only if token authentication is enabled on the library's pull zone
'tokenAuthKey' => '$BUNNY_STREAM_TOKEN_KEY',
],
],
// Volumes not listed here are left alone
'volumeVideoLibraries' => [
'videos' => 'default',
],
twig
{% set video = asset.bunnyVideo %}
{% if video and video.isReady %}
<video poster="{{ video.thumbnailUrl }}" controls>
<source src="{{ video.hlsUrl }}" type="application/x-mpegURL">
<source src="{{ video.mp4Url('720p') }}" type="video/mp4">
</video>
{% elseif video and video.isFailed %}
<p>{{ "This video could not be processed."|t }}</p>
{% elseif video %}
<p>{{ "Processing: {progress}%"|t({ progress: video.encodeProgress }) }}</p>
{% endif %}
php craft bunnymate/videos/create-missing
php craft bunnymate/videos/create-missing
php craft bunnymate/videos/refresh-existing
php craft bunnymate/videos/refresh-existing
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.