Download the PHP package kemp/bunny-stream without Composer
On this page you can find all versions of the php package kemp/bunny-stream. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kemp/bunny-stream
More information about kemp/bunny-stream
Files in kemp/bunny-stream
Package bunny-stream
Short Description Upload and embed videos from Bunny Stream
License MIT
Homepage https://laborb.de
Informations about the package bunny-stream
Bunny Stream
Bunny Stream is a Statamic addon that integrates the Bunny Stream API for single Stream libraries in the Statamic CP.
Features
- Upload and rename videos to Bunny Stream
- Automatically detect transcoding status
- Delete videos from Bunny Stream
- Embedding videos via a custom fieldtype or a custom tag
- Customizable plyr.js player included
How to Install
1. Install via composer
2. Insert CSS and JS files
For the videos to be displayed properly you need to add the Statamic Tag {{ video_styles:css }}
in the <head>
section
and the {{ video_styles:js }}
tag before the </body>
element in your layout.
This also includes hls.js
to support HLS streaming.
Alternatively you can add these tags only to pages you want to display videos.
How to configure
You need to provide the following config options in your evironment:
To embed the video use the play URL or the direct embed URL (https://yourdomain.com/BUNNY_PLAY_URL/embed/yourvideoID)
You can get all values in your Bunny Stream Dashboard at https://dash.bunny.net/stream/ Delivery > Stream > API
Add a custom CDN hostname
To add a custom hostname to host the videos from the CDN you can do the following:
- Login to your bunny dashboard and head over to
Delivery > Stream > API
- At Pull zone click
Manage
- Create a CName entry in your DNS settings pointing to the displayed bunny CDN hostname
- Enter your custom hostname in the bunny settings and activate SSL
- Use your custom hostname in the .env
BUNNY_CDN_HOSTNAME=yourcdnhostname
Now your videos are delivered over your custom hostname.
Publish config file (optional)
If you want, you can publish the config file.
How to Use
After you installed the addon you need to add your config options in your .env
first.
Upload videos
A new CP navigation item appears: Videobrowser
There you can upload and rename your video files.
When they are uploaded, they need to be processed. The videos are processed directly at bunny. The given progress indicator displays bunnys progress.
After the processing is done the video is available in the videobrowser and in the included fieldtype.
Work with videos
You can embed previously uploaded videos via the provided Statamic Tag {{ bunny_video }}
or in the content area via the provided Statamic Fieldtype Bunny
.
Video Tag
You should always use the provided Video
Tag as it includes all options that are available.
You need to add your own Statamic Fieldset with at least the Bunny Fieldtype included.
You can also add some options:
id
: Required Expects a valid Bunny Stream GUID. Automatically provided by the included Bunny Fieldtype.responsive
: Displays the video in a responsive way. It respects the given ratio(default: 16/9).ratio
: Expects one of the following ratios:1/1
,16/9
,4/3
,9/16
. Only works with theresponsive: true
.controls
: Iftrue
all controls are available in the video player. Iffalse
no controls are available and the video will autoplay muted in a loop.width
: Width of the video player. Only available withresponsive: false
. Preserves the videos ratio.height
: Height of the video player. Only available withresponsive: false
. Preserves the videos ratio.captions_enabled
: Enable or disable captions. Expects a boolean.captions_src
: The URL to the captions file. Expects a valid URL to a .vtt file.captions_src_lang
: The language of the captions file. Expects a valid language code. Eg.en
,de
,fr
, ...captions_lang
: The language of the captions to display in the settings. Expects a string likeEnglish
,Deutsch
,Français
, ...captions_default
: Iftrue
the captions are enabled by default. Iffalse
the user needs to enable them manually.class
: You can give additional classes for the video elementcolor
: You can set the color of the player controls. Expects a valid hexadecimal color code. Default is#333
Video captions
You can add captions to your videos. The captions file needs to be a valid .vtt file. You can host the file in statamic itself or on a different server.
Unfortunately, the Bunny Stream API does not support captions yet. You need to host the file yourself and provide the URL to the video tag.
Currently only one captions file is supported.
Thumbnails
You can get the video's thumbnail URL with the video tag: {{ bunny_video:thumbnail :id="bunny_field" }}
It expects the video ID as a parameter.
Example Fieldset
You can use this example fieldset with the provided tag as a layout to include all available options.
How to customize
The included video player is a simple plyr.js player with zero customization.
You can style the whole player to your needs with simple CSS classes: https://github.com/sampotts/plyr?tab=readme-ov-file#customizing-the-css