Skip to content

A Flutter-based live streaming application using Agora SDK with full host control over viewers and co-hosts. Perfect for creating Instagram-style live streams where the host can invite co-hosts and control who watches.

Notifications You must be signed in to change notification settings

Pinkisingh13/Agora-Live-Streaming-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“บ Agora Live Streaming App

โญ If you find this project helpful, please give it a star! โญ

A Flutter-based live streaming application using Agora SDK with full host control over viewers and co-hosts. Perfect for creating Instagram-style live streams where the host can invite co-hosts and control who watches.

App Demo


๐Ÿ“‹ Table of Contents


โœจ Features

Feature Description
๐ŸŽฌ Host Live Stream Start a live stream with your own channel name
๐Ÿ‘ฅ Co-Host Support Invite others to broadcast alongside you (split-screen view)
๐Ÿ‘€ Viewer Mode Allow viewers to watch without broadcasting
๐Ÿ” Access Control Host controls who can join via unique access codes
๐ŸŽค Audio Controls Mute/unmute microphone during stream
๐Ÿ“น Video Controls Turn camera on/off during stream
๐Ÿ“ค Easy Sharing Share access codes via any app or copy to clipboard
๐Ÿ“ฑ Cross-Platform Works on Android, iOS, macOS, Linux, and Windows

๐ŸŽฅ Demo

The GIF above shows the complete flow:

  1. Host starts a stream
  2. Host shares viewer/co-host codes
  3. Viewers and co-hosts join using the codes
  4. Split-screen view when co-host joins

๐Ÿ“ฆ Prerequisites

Before running this app, make sure you have:

  • โœ… Flutter SDK (version 3.10.4 or higher)
  • โœ… Dart SDK (comes with Flutter)
  • โœ… Android Studio or Xcode (for mobile development)
  • โœ… Agora Account (free tier available)

๐Ÿš€ Setup Instructions

Step 1: Clone the Repository

git clone <your-repo-url>
cd Agora-Live-Streaming-App

Step 2: Get Your Agora App ID (โš ๏ธ REQUIRED)

IMPORTANT: This app requires an Agora App ID to work. Without it, the live streaming will not function.

  1. Go to Agora Console
  2. Sign up for a free account (or log in)
  3. Click "Create a Project"
  4. Enter a project name (e.g., "LiveStreamApp")
  5. Select "APP ID" as the authentication mechanism (NOT Token)
  6. Click "Submit"
  7. Copy your App ID from the project dashboard

Step 3: Configure the App ID

  1. Navigate to the frontend folder:

    cd frontend
  2. Create or edit the .env file:

    # Create .env file if it doesn't exist
    touch .env
  3. Add your Agora App ID to the .env file:

    APP_ID=your_agora_app_id_here

    Example:

    APP_ID=48bd29358ed64d50a2496ca432adf444

โš ๏ธ Security Note: Never commit your actual App ID to public repositories. The .env file should be in .gitignore.

Step 4: Install Dependencies

cd frontend
flutter pub get

Step 5: Run the App

# For Android
flutter run -d android

# For iOS
flutter run -d ios

# For macOS
flutter run -d macos

# For any available device
flutter run

๐Ÿ“ฑ How to Use

๐ŸŽฌ As a Host (Starting a Stream)

  1. Open the app
  2. Enter a Channel Name (e.g., "mystream", "gaming", "cooking")
  3. Tap "Start as Host"
  4. Grant camera and microphone permissions when prompted
  5. You're now live! ๐Ÿ”ด
  6. Tap the Share icon (top right) to get access codes
  7. Share the codes with your audience:
    • Viewer Code โ†’ For people who want to watch
    • Co-Host Code โ†’ For people who want to broadcast with you

๐Ÿ‘€ As a Viewer (Watching a Stream)

  1. Get the Viewer Access Code from the host
  2. Open the app
  3. Paste the code in the "Access Code" field
  4. Tap "Join Stream"
  5. Enjoy watching! ๐Ÿ“บ

๐Ÿ‘ฅ As a Co-Host (Broadcasting with Host)

  1. Get the Co-Host Access Code from the host
  2. Open the app
  3. Paste the code in the "Access Code" field
  4. Tap "Join Stream"
  5. Grant camera and microphone permissions
  6. You're now broadcasting alongside the host! ๐ŸŽฅ

๐Ÿ“ Project Structure

Agora-Live-Streaming-App/
โ”œโ”€โ”€ README.md                    # This file
โ”œโ”€โ”€ agora_live_streaming.gif     # Demo GIF
โ”œโ”€โ”€ agora_live_streaming.mp4     # Demo video
โ”œโ”€โ”€ agora_live_streaming.mov     # Demo video (original)
โ”‚
โ””โ”€โ”€ frontend/                    # Flutter app
    โ”œโ”€โ”€ .env                     # โš ๏ธ Contains your Agora App ID
    โ”œโ”€โ”€ pubspec.yaml             # Dependencies
    โ”œโ”€โ”€ lib/
    โ”‚   โ”œโ”€โ”€ main.dart            # Main app code
    โ”‚   โ””โ”€โ”€ live_stream_screen.dart
    โ”œโ”€โ”€ android/                 # Android-specific files
    โ”œโ”€โ”€ ios/                     # iOS-specific files
    โ”œโ”€โ”€ macos/                   # macOS-specific files
    โ”œโ”€โ”€ linux/                   # Linux-specific files
    โ””โ”€โ”€ test/                    # Test files

๐Ÿ” Access Code System

The app uses a simple but effective code-based access control:

Code Format

Type Format Example
Viewer channelName_viewer_XXXXXX mystream_viewer_123456
Co-Host channelName_cohost_XXXXXX mystream_cohost_789012

How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                           HOST                                   โ”‚
โ”‚                                                                  โ”‚
โ”‚  1. Creates channel "mystream"                                   โ”‚
โ”‚  2. Generates unique codes:                                      โ”‚
โ”‚     โ€ข Viewer Code:  mystream_viewer_123456                       โ”‚
โ”‚     โ€ข Co-Host Code: mystream_cohost_789012                       โ”‚
โ”‚  3. Shares codes selectively                                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚                               โ”‚
              โ–ผ                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚        VIEWER           โ”‚     โ”‚        CO-HOST          โ”‚
โ”‚                         โ”‚     โ”‚                         โ”‚
โ”‚ โ€ข Enters viewer code    โ”‚     โ”‚ โ€ข Enters co-host code   โ”‚
โ”‚ โ€ข Can only watch        โ”‚     โ”‚ โ€ข Can broadcast video   โ”‚
โ”‚ โ€ข No camera/mic needed  โ”‚     โ”‚ โ€ข Appears in split view โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Why Codes Instead of Real-Time Requests?

  • โœ… Simple - No complex signaling infrastructure needed
  • โœ… Reliable - Works without additional messaging SDK
  • โœ… Host Control - Host decides who gets which code
  • โœ… Easy to Share - Codes can be shared via any messaging app

๐Ÿ”’ Permissions

Android Permissions (Automatically configured)

Permission Purpose
INTERNET Network access for streaming
CAMERA Video broadcasting
RECORD_AUDIO Audio broadcasting
MODIFY_AUDIO_SETTINGS Audio configuration
ACCESS_NETWORK_STATE Network status
BLUETOOTH Bluetooth audio devices
ACCESS_WIFI_STATE WiFi status

iOS Permissions (Automatically configured)

Permission Description in App
NSCameraUsageDescription "This app needs camera access for live streaming"
NSMicrophoneUsageDescription "This app needs microphone access for live streaming"

Permission Handling

The app automatically:

  1. Requests permissions when you try to start/join as host or co-host
  2. Shows a dialog if permissions are denied
  3. Offers to open device settings if permissions are permanently denied

๐Ÿ”ง Troubleshooting

Common Issues

Issue Solution
"Camera/Mic not working" Grant permissions in device settings
"Cannot connect to stream" Check your internet connection
"Invalid code" Make sure you copied the entire code
"App crashes on start" Verify your Agora App ID in .env file
"Black screen on video" Restart the app and grant camera permission

iOS Simulator Limitation

โš ๏ธ Note: iOS Simulator does NOT support camera or microphone hardware. Test on a real iOS device or use Android emulator/macOS for full functionality.

Resetting Permissions

Android:

  1. Go to Settings โ†’ Apps โ†’ Live Stream โ†’ Permissions
  2. Enable Camera and Microphone

iOS:

  1. Go to Settings โ†’ Privacy โ†’ Camera/Microphone
  2. Enable for Live Stream app

๐Ÿ“š Dependencies

Package Version Purpose
agora_rtc_engine ^6.3.0 Agora's Flutter SDK for video streaming
permission_handler ^11.0.1 Request camera/mic permissions
share_plus ^7.2.2 Share access codes
flutter_dotenv ^5.1.0 Load environment variables (.env file)
cupertino_icons ^1.0.8 iOS-style icons

๐ŸŽฎ Controls Reference

Host/Co-Host Controls

Button Action
๐ŸŽค Mic Toggle microphone on/off
๐Ÿ“น Camera Toggle camera on/off
๐Ÿ“ž End Leave the stream
๐Ÿ“ค Share View and share access codes

Viewer Controls

Button Action
๐Ÿ“ž End Leave the stream

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ž Support

If you encounter any issues:

  1. Check the Troubleshooting section
  2. Review Agora Documentation
  3. Open an issue in this repository

Made with โค๏ธ using Flutter and Agora SDK

About

A Flutter-based live streaming application using Agora SDK with full host control over viewers and co-hosts. Perfect for creating Instagram-style live streams where the host can invite co-hosts and control who watches.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published