Skip to content

[Feature]: Return Bunny Stream libraryId in API responses #13

@notflip

Description

@notflip

Your Question

When I use a Video collection, the data saved is

{

    "id": 2,
    "title": "Test",
    "bunnyVideoId": "7bb3899c-4eb9-4d5a-b336-b48fd9639xxx",
    "prefix": "video",
    "updatedAt": "2025-10-12T11:47:19.272Z",
    "createdAt": "2025-10-12T11:47:19.272Z",
    "url": "https://vz-xxx-7c3.b-cdn.net/7bb3899c-4eb9-4d5a-b336-b48fd9639a59/playlist.m3u8",
    "thumbnailURL": "https://vz-xxx-7c3.b-cdn.net/7bb3899c-4eb9-4d5a-b336-b48fd9639a59/thumbnail.jpg?t=1760270050210",
    "filename": "Toerisme Duitsland - stop motionNL_v4.mp4",
    "mimeType": "video/mp4",
    "filesize": 28783262,
    "width": null,
    "height": null,
    "focalX": null,
    "focalY": null

}

However to embed the video stream using an iframe we need the following URL

https://iframe.mediadelivery.net/embed/`{video_library_id}`/`{video_id}`

So video_library_id is not saved alongside the data, what's the most common way to get this? Using NEXT_PUBLIC_BUNNY_STREAM_LIBRARY_ID?

Current Configuration (if relevant)

    bunnyStorage({
      collections: {
        media: {
          prefix: "media",
          disablePayloadAccessControl: true, // Use direct CDN access
        },
        videos: {
          prefix: "video",
          disablePayloadAccessControl: true,
        },
      },
      adminThumbnail: {
        appendTimestamp: true,
        sizeName: "thumbnail",
      },
      stream: {
        apiKey: process.env.BUNNY_STREAM_API_KEY!,
        hostname: process.env.BUNNY_STREAM_HOSTNAME!,
        libraryId: parseInt(process.env.BUNNY_STREAM_LIBRARY_ID!),
        cleanup: true,
      },
      storage: {
        apiKey: process.env.BUNNY_STORAGE_API_KEY!,
        hostname: process.env.BUNNY_HOSTNAME!,
        zoneName: process.env.BUNNY_ZONE_NAME!,
      },
      purge: {
        apiKey: process.env.BUNNY_API_KEY!,
        async: false,
      },
    }),

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions