This custom Drupal module provides automatic synchronization between Bunny Stream library and Drupal media entities.
- One-click sync: Sync all videos from a Bunny Stream library to Drupal media entities
- Automatic detection: Detects existing media entities and updates them if needed
- Error handling: Comprehensive error handling and logging
- Admin interface: Easy-to-use admin form for selecting and syncing libraries
- Drupal 10
- Bunny Stream module
- Configured Bunny Stream library with API key
- Place this module in
web/modules/custom/bunny_stream_sync/ - Enable the module:
drush en bunny_stream_sync - Grant the "Administer Bunny Stream Sync" permission to appropriate roles
- Navigate to Configuration > Services > Bunny Stream > Sync Library
- Select the Bunny Stream library you want to sync
- Click "Sync Library" button
- The module will:
- Fetch all videos from the selected Bunny Stream library
- Create new media entities for videos that don't exist in Drupal
- Update existing media entities if their titles have changed
- Skip videos that are already up-to-date
Before using the sync functionality, ensure you have:
- Bunny Stream Library configured: Go to Configuration > Services > Bunny Stream > Library and create a library with your API key
- Media Type configured: Create a media type that uses the "Bunny Stream" source and select your library
administer bunny_stream_sync: Access to sync Bunny Stream library with Drupal media entities
The module uses the Bunny Stream API endpoint:
GET https://video.bunnycdn.com/library/{libraryId}/videos- Lists all videos in a library
All sync operations are logged to the bunny_stream_sync channel. Check the Drupal logs for detailed information about sync operations.
- No libraries found: Ensure you have created at least one Bunny Stream library configuration
- API errors: Verify your API key is correct and has proper permissions
- No media type found: Create a media type that uses the Bunny Stream source and is configured for your library