Bunny Webhook

Updated

Pro feature. Available in MediaShield Pro.

PRO - requires MediaShield Pro and a Bunny Stream connection.

A webhook lets Bunny Stream tell your site when a video has finished encoding (or failed). MediaShield then fills in the real video length, refreshes the thumbnail and records the encoding status. Without it, a freshly uploaded Bunny video keeps a length of zero until you set it by hand.

Why use it#

New Bunny uploads get their real length and a fresh thumbnail on their own. Completion percentages and mid-roll ad breaks need the length, so without it a new video is awkward to measure.

Before you start#

  • Connect Bunny Stream.
  • Your site must be reachable from the internet. A local .test or .local site cannot receive Bunny's call.

Set it up#

  1. Go to MediaShield > Platforms.
  2. In Connect a Platform, choose Bunny Stream. The form shows a Webhook URL. It ends with ms_token= and a long secret.
  3. Copy the whole address.
  4. In the Bunny dashboard, open your Stream library and find Webhook.
  5. Paste the address and save.

The secret in the address is created for you the first time it is needed. Treat the address like a password.

What happens when Bunny calls#

Bunny status What MediaShield does
Finished (4) Saves the video length, marks the video's encoding status as finished, refreshes the thumbnail from Bunny
Error (5) Marks the video's encoding status as error. With WP_DEBUG on, writes a line to the PHP log
Anything else (created, uploaded, processing, transcoding) Nothing. The call is answered and ignored

The video is found by its Bunny video ID. A call for a video that is not in your library is ignored.

Security#

The address is public by necessity, because Bunny does not log in. Each call must carry either the secret in ms_token, or a valid X-Bunny-Webhook-Signature header (an HMAC SHA-256 of the body using the same secret). Calls with neither are refused with a 403 and do nothing. This stops strangers from changing a video's length or forcing thumbnail downloads.

What viewers see#

Viewers see nothing. Their lesson simply shows the right length and thumbnail.

Settings and options#

Name Default What it does
Webhook URL Generated Shown on the Platforms page. Read only
ms_bunny_webhook_key Generated on first use The secret. Kept after Pro is deleted. Delete the option to make a new one, then paste the new address into Bunny

Next steps#

If the length stays at zero, see Troubleshooting. Developers can react to the events with mediashield_bunny_encoded and mediashield_bunny_failed. See Hooks and Filters.