ToshY / BunnyNet-PHP

Bunny.net CDN API PHP library.
https://toshy.github.io/BunnyNet-PHP/
MIT License
44 stars 7 forks source link

[Feature]: Stream API - Add `OEmbed` endpoint #113

Closed ToshY closed 7 months ago

ToshY commented 8 months ago

Description

  1. Add the following endpoints for OEmbed

  2. Add corresponding documentation.


I did not know what "oEmbed" was or how it can be used, support team gave me the following answer:

This endpoint is used to return metadata about the video for services that support or use oEmbed, like embed.ly. You need to pass a URL query string as seen in the documents. Example Video: https://iframe.mediadelivery.net/embed/182595/8a800e53-c949-46d0-8818-af566f032ec1

Example

Example cURL:

request

curl --request GET \
     --url 'https://video.bunnycdn.com/OEmbed?url=https%3A%2F%2Fiframe.mediadelivery.net%2Fembed%2F182595%2F8a800e53-c949-46d0-8818-af566f032ec1' \
     --header 'accept: application/json'

response

{
  "version": "1.0",
  "title": "鶴島の魅力を紹介!(Tsurushima no miryoku o shōkai!)",
  "type": "video",
  "thumbnail_url": "https://vz-9d706929-bc7.b-cdn.net/8a800e53-c949-46d0-8818-af566f032ec1/thumbnail.jpg",
  "width": 1920,
  "height": 1080,
  "html": "<iframe src=\"https://iframe.mediadelivery.net/embed/182595/8a800e53-c949-46d0-8818-af566f032ec1?autoplay=true\" loading=\"lazy\" width=\"1920\" height=\"1080\" style=\"border: none;\" allow=\"fullscreen; accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;\"></iframe>",
  "provider_name": "bunny.net",
  "provider_url": "https://bunny.net/"
}