SpoutBreeze BBB Broadcaster is a Go-based backend service that enables broadcasting BigBlueButton (BBB) sessions via RTMP streams. It provides a simple REST API endpoint that accepts streaming parameters and automatically joins a BBB session as a moderator to start broadcasting.
The service uses Selenium WebDriver to automate browser interactions with BigBlueButton sessions, making it ideal for automated broadcasting, recording, or stream redistribution workflows.
- RESTful API endpoint for initiating BBB broadcasting sessions
- Automated browser interaction with BigBlueButton using Selenium
- Containerization support with Docker and Kubernetes/Minikube
- Environment variable configuration
- Backend: Go (Golang) with Gin framework
- Browser Automation: Selenium WebDriver with Chrome
- Container Orchestration: Kubernetes/Minikube
- Deployment: Docker
spoutbreeze/
├── .env # Environment variables
├── main.go # Entry point that initializes and runs the server
├── controllers/
│ └── broadcasterController.go # Handles HTTP requests
├── initializers/
│ └── loadEnvVariables.go # Loads environment variables
├── models/
│ └── broadcaster.go # Data structures for the API
├── routes/
│ └── routes.go # API route definitions
├── services/
│ └── broadcasterService.go # Business logic for BBB streaming
└── Dockerfile # Docker configuration for containerization
- Go 1.18 or later
- Kubernetes/Minikube with Moon Selenium Grid installed
- Chrome browser in Moon Selenium Grid
git clone https://github.com/Bouchiba43/spoutbreeze-rtmp-svc.git
cd spoutbreezeCreate a .env file in the project root:
# The IP address of your Minikube or Kubernetes cluster, used to access services externally
CLUSTER_IP=your_minikube_or_k8s_cluster_ip
# The port on which the Moon Selenium Hub is exposed (e.g., 4444)
MOON_SELENIUM_PORT=4444
# Default gin server port
PORT=1323
go mod tidygo build -o spoutbreeze./spoutbreezeThe project uses Ginkgo and Gomega testing frameworks for comprehensive testing of the application.
# Install Ginkgo and Gomega
go get -u github.com/onsi/ginkgo/v2/ginkgo
go get -u github.com/onsi/gomega
go install github.com/onsi/ginkgo/v2/ginkgo@latestThe project includes several testing options via the Makefile:
# Run all standard tests (excluding Selenium-dependent tests)
make test
# Run tests with verbose output
make test-verbose
# Run only controller tests
make test-controllers
# Run tests with code coverage report
make test-coverage
# Continuously run tests when files change (watch mode)
make test-watch
# Run tests for CI environments with JUnit reports
make test-ciTo generate a test coverage report:
make test-coverageThis will create an HTML coverage report (coverage.html) that you can view in any browser.
The tests are organized by component:
-
Controller Tests: Test the API endpoints and request handling
- Located in
controllers/tests/ - Use mocked services to isolate from external dependencies
- Located in
-
Service Tests: Test the business logic
- Located in
services/tests/ - Some tests may require Selenium and are skipped by default
- Located in
-
Integration Tests: Test the full flow from request to processing
- Located at project root level
To generate new test files for a package:
# Replace 'package_name' with the target package
ginkgo generate package_nameFor more complex packages that require test suites:
cd package_name
ginkgo bootstrap
ginkgo generate file_namedocker build -t spoutbreeze:latest .docker run -p 8080:8080 --env-file .env spoutbreeze:latestInitiates a BigBlueButton session join and prepares for broadcasting.
Endpoint: POST /broadcaster/joinBBB
Request Body:
{
"bbb_server_url": "https://bbb-server.com/bigbluebutton/api/join?fullName=User&meetingID=meeting1&password=mp&redirect=true&checksum=abcdef123456",
"rtmp_url": "rtmp://streaming-server.com/live/{$stream-key}",
"stream_url": "stream-key"
}Parameters:
bbb_server_url(string, required): The BigBlueButton server URL with join parameters and checksumrtmp_url(string, required): RTMP URL for streamingstream_url(string, required): Public stream URL for viewers
Response:
- Success (200 OK):
{ "message": "Broadcasting session started successfully" } - Error (400 Bad Request):
{ "error": "error message" } - Error (500 Internal Server Error):
{ "error": "error message" }
Environment Variables:
- Loads configuration from the
.envfile
Defines the data structure for the broadcaster request:
BBBServerURL: URL to join the BigBlueButton sessionRTMPURL: RTMP URL for streamingStreamURL: Public stream URL
Handles HTTP requests to the API endpoint:
- Validates the incoming JSON request
- Calls the service layer to process the request
Contains the core business logic:
- Launches a Selenium script in the background to join the BBB session
- Implements the
StreamBBBSessionfunction that automates the browser interaction with BBB
Defines API routes:
- Configures the
/broadcaster/joinBBBendpoint
The StreamBBBSession function performs the following actions:
- Connects to the Moon Selenium Grid on Minikube
- Launches a Chrome browser with video capability enabled
- Navigates to the BBB session URL
- Waits for the page to load
- Handles any consent popups
- Clicks the "Listen only" button in the BBB session
- Maintains the session for 10 minutes (600 seconds)
Symptoms: "Error starting browser" messages. Solution:
- Verify the Moon Selenium Grid is running
- Check the Moon service endpoint (e.g., 192.168.49.2:32440)
- Ensure Chrome browser is available in the Moon container
kubectl get pods -n moon
kubectl logs <moon-pod-name> -n moonSymptoms: "Failed to navigate" or no "Listen only" button found. Solution:
- Verify the BBB URL is valid and contains required parameters
- Check BBB server health
- Verify the session is actually running on the BBB server
Symptoms: Tests failing with connection errors to Selenium. Solution:
- For basic tests, use
make testwhich skips Selenium-dependent tests - For Selenium tests, ensure the Moon Selenium Grid is running and accessible
- Mock external services in tests using the provided test helpers
# Check if the test environment variables are set correctly
cat .env
# Run tests that don't rely on external dependencies
make test-controllers- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request