Custom Backgrounds
Load custom background images during video calls from your own web server.
Microsoft Teams now supports custom backgrounds natively in the browser. This workaround may be removed in future releases to reduce application complexity. Consider using the native Teams custom background feature when possible.
See the example README for a complete implementation example.
Important Considerations
-
Enabling the Feature:
To activate custom backgrounds, launch the application with:
--isCustomBackgroundEnabled=trueFor Apache2 users, you might need to add a configuration like the following in your
/etc/apache2/apache2.conf:<Directory /var/www/>
Header set Access-Control-Allow-Origin "*"
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory> -
Static Image Management:
The app does not currently support adding or removing custom images dynamically. You must host your images on a local or remote web server. -
Configuration Options:
Two configuration options are used for custom backgrounds:customBGServiceBaseUrl: The base URL of your web server providing custom background images.customBGServiceConfigFetchInterval: The poll interval (in seconds) at which the app fetches background configuration data.
-
URL Structure for Images:
Custom images are always loaded using the pattern:
<customBGServiceBaseUrl>/<image-path>
Make sure your web server is running and that the specified base URL responds correctly. -
CORS Requirement:
You can use any web server of your choice, but ensure that it includes anAccess-Control-Allow-Origin: *header in its responses so the app can load images without cross-origin issues.
Configuring the List of Images
Configuration File Location
The list of custom images should be stored at:
<customBGServiceBaseUrl>/config.json
Example Configuration File
The configuration should be a JSON object with a videoBackgroundImages
array. For example:
{
"videoBackgroundImages": [
{
"filetype": "png",
"id": "Custom_bg01",
"name": "Custom Background",
"src": "/evergreen-assets/backgroundimages/<path-to-image>",
"thumb_src": "/evergreen-assets/backgroundimages/<path-to-thumb-image>"
}
]
}
This JSON array allows you to define any number of images. Replace
<path-to-image> and <path-to-thumb-image> with the actual paths relative
to your customBGServiceBaseUrl.
Configuration Properties
| Property | Description | Recommendations |
|---|---|---|
filetype | The type of image (e.g., jpg, png) | Use common web formats |
id | A unique identifier for the image | Use unique names without spaces |
name | The display name for your image | Keep descriptive but concise |
src | Path to the full-resolution image | Use ~1920x1080 resolution |
thumb_src | Path to the thumbnail image | Use ~280x158 resolution for faster loading |
Image paths are relative to customBGServiceBaseUrl. For example, if your
customBGServiceBaseUrl is https://example.com and your image is at
https://example.com/images/sample.jpg, then src would be
/evergreen-assets/backgroundimages/images/sample.jpg.
Setup Examples
Local Web Server Setup
Using Python HTTP Server
# Navigate to your images directory
cd /path/to/your/images
# Start a simple HTTP server
python3 -m http.server 8080
# Configure Teams for Linux
teams-for-linux --isCustomBackgroundEnabled=true --customBGServiceBaseUrl=http://localhost:8080
Using Node.js HTTP Server
# Install http-server globally
npm install -g http-server
# Navigate to your images directory
cd /path/to/your/images
# Start server with CORS enabled
http-server -p 8080 --cors
# Configure Teams for Linux
teams-for-linux --isCustomBackgroundEnabled=true --customBGServiceBaseUrl=http://localhost:8080
Advanced Configuration
Persistent Configuration
Add to your ~/.config/teams-for-linux/config.json:
{
"isCustomBackgroundEnabled": true,
"customBGServiceBaseUrl": "http://localhost:8080",
"customBGServiceConfigFetchInterval": 300
}
Corporate Environment Setup
For corporate environments with existing web infrastructure:
{
"isCustomBackgroundEnabled": true,
"customBGServiceBaseUrl": "https://intranet.company.com/teams-backgrounds",
"customBGServiceConfigFetchInterval": 3600
}
Troubleshooting
Common Issues
Backgrounds Not Loading
- Check CORS headers: Ensure your web server includes
Access-Control-Allow-Origin: * - Verify URL accessibility: Test that
<customBGServiceBaseUrl>/config.jsonis reachable - Check image paths: Ensure image files exist at the specified paths
Poor Performance
- Optimize image sizes: Use recommended resolutions (1920x1080 for full, 280x158 for thumbnails)
- Adjust fetch interval: Increase
customBGServiceConfigFetchIntervalto reduce server load - Use local server: Host images locally for better performance
Configuration Not Updating
- Check fetch interval: Ensure
customBGServiceConfigFetchIntervalis set appropriately - Restart application: Changes may require restarting Teams for Linux
- Verify JSON syntax: Validate your config.json file syntax
Debug Mode
Enable debug logging to troubleshoot custom background issues:
teams-for-linux --logConfig='{"level":"debug"}' --isCustomBackgroundEnabled=true
Security Considerations
- Only host custom backgrounds on trusted servers
- Regularly review and update background image content
- Consider bandwidth usage in corporate environments
- Ensure CORS configuration doesn't overly expose your server
Best Practices
- Use HTTPS: Secure your background image server with SSL/TLS
- Validate Content: Ensure background images are appropriate for business use
- Monitor Usage: Track bandwidth and server load from background requests
- Regular Updates: Keep background collection fresh and relevant
Related Documentation
- Configuration Options - Complete configuration reference
- IPC API - Background management IPC channels