Screen Sharing
Share your screen, application windows, or browser tabs with high quality
Overview
Screen sharing allows participants to share their entire screen, specific application windows, or browser tabs with others in real-time. Essential for presentations, demos, remote collaboration, and online teaching, BaxCloud's screen sharing provides high-quality video transmission with optional audio capture for system sounds.
Full Screen
Share your entire screen with all participants
Window Sharing
Share specific application windows
System Audio
Share audio from your computer
Common Use Cases
Presentations & Demos
Share slides, documents, or application demos during meetings and webinars. Perfect for sales demos, product showcases, and business presentations.
Remote Collaboration
Work together on code, designs, or documents in real-time. Share your IDE, design tools, or spreadsheets while discussing with team members.
Online Teaching
Teachers can share educational content, software tutorials, or interactive lessons. Students see exactly what the teacher is demonstrating.
Technical Support
Support agents can see customer screens to diagnose issues, or share their own screen to guide customers through solutions step-by-step.
How Screen Sharing Works
Screen sharing uses WebRTC's getDisplayMedia API to capture screen content:
1. Source Selection
When you initiate screen sharing, the browser shows a picker dialog with three options:
- Entire Screen: Shares everything visible on your display
- Application Window: Shares a specific app (e.g., Chrome, VS Code)
- Browser Tab: Shares only a specific browser tab
2. Capture & Encoding
Once selected, the screen content is captured at your configured frame rate (typically 15-30 fps). Video is encoded using VP8 or H.264 codec, optimized for screen content with higher quality for text and graphics. Bitrates are automatically adjusted based on content complexity and network conditions.
3. Audio Capture (Optional)
Modern browsers support sharing system audio (sounds playing on your computer). This is perfect for sharing videos, music, or game audio. Audio is captured separately and synchronized with video.
4. Transmission & Display
Encoded screen video is transmitted to BaxCloud servers and forwarded to other participants. Viewers receive the stream and render it in their UI. Typically 1-3 seconds latency for real-time collaboration.
Step-by-Step Implementation
Add screen sharing to your application
Start Screen Sharing
Initiate screen sharing from your app
Allow users to start sharing their screen:
1import { BaxCloudClient } from '@baxcloud/react-sdk';
2import { useState } from 'react';
3
4function ScreenShareButton() {
5 const [isSharing, setIsSharing] = useState(false);
6 const client = new BaxCloudClient({
7 projectId: 'your-project-id',
8 apiKey: 'your-api-key',
9 });
10
11 const startScreenShare = async () => {
12 try {
13 await client.enableScreenShare();
14 setIsSharing(true);
15 console.log('Screen sharing started');
16 } catch (error) {
17 console.error('Failed to start screen sharing:', error);
18 }
19 };
20
21 const stopScreenShare = async () => {
22 try {
23 await client.disableScreenShare();
24 setIsSharing(false);
25 console.log('Screen sharing stopped');
26 } catch (error) {
27 console.error('Failed to stop screen sharing:', error);
28 }
29 };
30
31 return (
32 <button onClick={isSharing ? stopScreenShare : startScreenShare}>
33 {isSharing ? 'Stop Sharing' : 'Share Screen'}
34 </button>
35 );
36}Browser Picker
Check Screen Share Status
Check if screen sharing is enabled
Monitor screen sharing status:
1import { BaxCloudClient, BaxCloudRoomController } from '@baxcloud/react-sdk';
2
3const client = new BaxCloudClient({
4 projectId: 'your-project-id',
5 apiKey: 'your-api-key',
6});
7
8const controller = BaxCloudRoomController.instance;
9
10// Check if screen sharing is enabled
11const isSharing = controller.isScreenShareEnabled();
12console.log('Screen sharing:', isSharing ? 'enabled' : 'disabled');
13
14// Get participants and check their screen share status
15const participants = controller.getParticipants();
16const sharingParticipant = participants.find(p => p.isScreenShareEnabled);
17if (sharingParticipant) {
18 console.log(`${sharingParticipant.name} is sharing their screen`);
19}Layout Optimization
Monitor Screen Sharing
Track when participants start or stop sharing
Monitor screen sharing activity using participant updates:
1import { BaxCloudRoomController } from '@baxcloud/react-sdk';
2import { useEffect, useState } from 'react';
3
4const controller = BaxCloudRoomController.instance;
5
6function ScreenShareMonitor() {
7 const [participants, setParticipants] = useState([]);
8
9 useEffect(() => {
10 const updateParticipants = () => {
11 const allParticipants = controller.getParticipants();
12 setParticipants(allParticipants);
13
14 // Check for screen shares
15 const sharingParticipant = allParticipants.find(p => p.isScreenShareEnabled);
16 if (sharingParticipant) {
17 console.log(`${sharingParticipant.name} is sharing screen`);
18 }
19 };
20
21 updateParticipants();
22
23 // Listen for participant changes
24 const unsubscribeJoined = controller.onUserJoined(() => {
25 updateParticipants();
26});
27
28 const unsubscribeLeft = controller.onUserLeft(() => {
29 updateParticipants();
30 });
31
32 return () => {
33 unsubscribeJoined();
34 unsubscribeLeft();
35 };
36 }, []);
37
38 const sharingParticipant = participants.find(p => p.isScreenShareEnabled);
39
40 return (
41 <div>
42 {sharingParticipant ? (
43 <div>${sharingParticipant.name} is sharing their screen</div>
44 ) : (
45 <div>No one is sharing their screen</div>
46 )}
47 </div>
48 );
49}Best Practices
Switch layout when screen sharing starts
Automatically switch to a layout that prominently displays the screen share when someone starts sharing. Return to grid layout when sharing stops.
Optimize quality for content type
Use lower frame rates (15 fps) for slides and documents, higher rates (30+ fps) for videos and animations. Adjust resolution based on network conditions.
Show clear screen share indicators
Display a banner or indicator showing who is currently sharing their screen. Make it easy for the presenter to stop sharing with a prominent button.
Limit concurrent screen shares
Allow only one screen share at a time to avoid confusion. Automatically stop the previous share when someone new starts sharing.
Provide audio capture option
Let users choose whether to share system audio. Show a checkbox in your UI before starting screen share, especially when sharing videos or presentations.
Handle permission errors gracefully
Show clear error messages when screen sharing fails due to permissions. Guide users on how to enable screen sharing in their browser settings.
Troubleshooting
Screen Share Button Not Working
- Verify browser supports screen sharing (Chrome, Edge, Firefox, Safari 13+)
- Check that page is served over HTTPS (required for screen sharing)
- Ensure user has permission to share screen in room settings
- Look for JavaScript errors in browser console
Poor Screen Share Quality
- Reduce frame rate to 15-20 fps for presentations
- Lower resolution if network is unstable
- Close unnecessary applications to free up CPU
- Check network bandwidth - screen sharing uses 1-5 Mbps
System Audio Not Captured
- Verify browser supports system audio (Chrome/Edge on Windows/Mac)
- Check "Share audio" checkbox in browser's screen picker
- Ensure system volume is not muted
- Safari and Firefox don't support system audio capture
Screen Share Automatically Stops
- User may have clicked "Stop Sharing" in browser UI
- Shared tab or window may have been closed
- Browser may have revoked permission due to inactivity
- Check for system-level permission changes