├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── video_streaming │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── data │ ├── datasources │ │ └── remote_datasource.dart │ └── repositories │ │ ├── auth_repository.dart │ │ └── room_repository.dart ├── di │ ├── cubit_module.dart │ ├── data_source_module.dart │ ├── injector.dart │ ├── interactor_module.dart │ └── repository_module.dart ├── domain │ ├── interactors │ │ └── webrtc_interactor.dart │ └── repositories │ │ ├── auth_repository.dart │ │ └── room_repository.dart ├── main.dart ├── presentation │ ├── app │ │ └── app.dart │ └── pages │ │ └── webrtc │ │ ├── webrtc_cubit.dart │ │ ├── webrtc_page.dart │ │ └── webrtc_state.dart └── utils │ └── logger.dart ├── pubspec.lock └── pubspec.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | 46 | # Google Services 47 | /android/app/google-services.json 48 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 17 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 18 | - platform: android 19 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 20 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 21 | - platform: ios 22 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 23 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 24 | - platform: linux 25 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 26 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 27 | - platform: macos 28 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 29 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 30 | - platform: web 31 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 32 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 33 | - platform: windows 34 | create_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 35 | base_revision: e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | Before running application do the following steps to set up a server part of the app. 4 | 5 | ### Firebase connect 6 | 7 | 1. Create new firebase project (https://console.firebase.google.com) 8 | 9 | ![Image alt1](https://i.ibb.co/Tw1jXrP/image.png) 10 | 11 | 12 | 2. Add app(s) to the project (follow firebase tutorials) 13 | 14 | ![Image alt2](https://i.ibb.co/6B1c3v0/001.jpg) 15 | 16 | 17 | 3. Create Firestore database 18 | 19 | ![Image alt3](https://i.ibb.co/PZ3q3qq/002.jpg) 20 | 21 | 22 | 4. Enable anonymous authentication 23 | 24 | ![Image alt4](https://i.ibb.co/jf9hPT0/003.jpg) 25 | 26 | ![Image alt5](https://i.ibb.co/XYLXCMV/004.jpg) 27 | 28 | ![Image alt6](https://i.ibb.co/ZKxxdLf/005.jpg) 29 | 30 | #### All done! 31 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | exclude: 3 | - build/** 4 | errors: 5 | unused_field: ignore 6 | unused_element: ignore 7 | 8 | linter: 9 | rules: 10 | #ERROR RULES 11 | - avoid_empty_else 12 | - avoid_relative_lib_imports 13 | - avoid_returning_null_for_future 14 | - avoid_types_as_parameter_names 15 | - control_flow_in_finally 16 | - empty_statements 17 | - iterable_contains_unrelated_type 18 | - list_remove_unrelated_type 19 | - literal_only_boolean_expressions 20 | - no_adjacent_strings_in_list 21 | - no_duplicate_case_values 22 | - always_use_package_imports 23 | - prefer_void_to_null 24 | - unnecessary_statements 25 | - valid_regexps 26 | 27 | #STYLE RULES 28 | - always_declare_return_types 29 | - always_require_non_null_named_parameters 30 | - annotate_overrides 31 | - avoid_catching_errors 32 | - avoid_equals_and_hash_code_on_mutable_classes 33 | - avoid_function_literals_in_foreach_calls 34 | - avoid_init_to_null 35 | - avoid_null_checks_in_equality_operators 36 | - avoid_private_typedef_functions 37 | - avoid_renaming_method_parameters 38 | - avoid_return_types_on_setters 39 | - avoid_returning_null 40 | - avoid_returning_this 41 | - avoid_shadowing_type_parameters 42 | - avoid_single_cascade_in_expression_statements 43 | - avoid_types_on_closure_parameters 44 | - avoid_unnecessary_containers 45 | - camel_case_extensions 46 | - camel_case_types 47 | - constant_identifier_names 48 | - curly_braces_in_flow_control_structures 49 | - directives_ordering 50 | - empty_catches 51 | - empty_constructor_bodies 52 | - file_names 53 | - implementation_imports 54 | - library_names 55 | - library_prefixes 56 | - non_constant_identifier_names 57 | - null_closures 58 | - omit_local_variable_types 59 | - prefer_adjacent_string_concatenation 60 | - prefer_collection_literals 61 | - prefer_conditional_assignment 62 | - prefer_const_constructors 63 | - prefer_contains 64 | - prefer_equal_for_default_values 65 | - prefer_final_fields 66 | - prefer_for_elements_to_map_fromIterable 67 | - prefer_function_declarations_over_variables 68 | - prefer_generic_function_type_aliases 69 | - prefer_if_null_operators 70 | - prefer_initializing_formals 71 | - prefer_inlined_adds 72 | - prefer_interpolation_to_compose_strings 73 | - prefer_is_empty 74 | - prefer_is_not_empty 75 | - prefer_iterable_whereType 76 | - prefer_mixin 77 | - prefer_null_aware_operators 78 | - prefer_single_quotes 79 | - prefer_spread_collections 80 | - prefer_typing_uninitialized_variables 81 | - recursive_getters 82 | - type_annotate_public_apis 83 | - type_init_formals 84 | - unnecessary_brace_in_string_interps 85 | - unnecessary_const 86 | - unnecessary_getters_setters 87 | - unnecessary_lambdas 88 | - unnecessary_new 89 | - unnecessary_null_aware_assignments 90 | - unnecessary_null_in_if_null_operators 91 | - unnecessary_overrides 92 | - unnecessary_string_escapes 93 | - unnecessary_this 94 | - use_function_type_syntax_for_parameters 95 | - use_rethrow_when_possible 96 | - use_setters_to_change_properties 97 | - use_to_and_as_if_applicable 98 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | apply plugin: 'com.google.gms.google-services' 28 | 29 | android { 30 | compileSdkVersion flutter.compileSdkVersion 31 | ndkVersion flutter.ndkVersion 32 | 33 | kotlinOptions { 34 | jvmTarget = '1.8' 35 | } 36 | 37 | sourceSets { 38 | main.java.srcDirs += 'src/main/kotlin' 39 | } 40 | 41 | defaultConfig { 42 | applicationId "com.example.video_streaming" 43 | minSdkVersion 29 44 | targetSdkVersion 33 45 | compileSdkVersion 31 46 | versionCode flutterVersionCode.toInteger() 47 | versionName flutterVersionName 48 | } 49 | 50 | buildTypes { 51 | release { 52 | // TODO: Add your own signing config for the release build. 53 | // Signing with the debug keys for now, so `flutter run --release` works. 54 | signingConfig signingConfigs.debug 55 | } 56 | } 57 | } 58 | 59 | flutter { 60 | source '../..' 61 | } 62 | 63 | dependencies { 64 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 65 | implementation 'com.google.firebase:firebase-bom:31.0.3' 66 | } 67 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 25 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/video_streaming/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.video_streaming 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.google.gms:google-services:4.3.14' 10 | classpath 'com.android.tools.build:gradle:7.1.2' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | rootProject.buildDir = '../build' 23 | subprojects { 24 | project.buildDir = "${rootProject.buildDir}/${project.name}" 25 | } 26 | subprojects { 27 | project.evaluationDependsOn(':app') 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1300; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = ( 294 | "$(inherited)", 295 | "@executable_path/Frameworks", 296 | ); 297 | PRODUCT_BUNDLE_IDENTIFIER = com.example.videoStreaming; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 300 | SWIFT_VERSION = 5.0; 301 | VERSIONING_SYSTEM = "apple-generic"; 302 | }; 303 | name = Profile; 304 | }; 305 | 97C147031CF9000F007C117D /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ALWAYS_SEARCH_USER_PATHS = NO; 309 | CLANG_ANALYZER_NONNULL = YES; 310 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 311 | CLANG_CXX_LIBRARY = "libc++"; 312 | CLANG_ENABLE_MODULES = YES; 313 | CLANG_ENABLE_OBJC_ARC = YES; 314 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_COMMA = YES; 317 | CLANG_WARN_CONSTANT_CONVERSION = YES; 318 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 320 | CLANG_WARN_EMPTY_BODY = YES; 321 | CLANG_WARN_ENUM_CONVERSION = YES; 322 | CLANG_WARN_INFINITE_RECURSION = YES; 323 | CLANG_WARN_INT_CONVERSION = YES; 324 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 325 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 326 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 329 | CLANG_WARN_STRICT_PROTOTYPES = YES; 330 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | DEBUG_INFORMATION_FORMAT = dwarf; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | ENABLE_TESTABILITY = YES; 338 | GCC_C_LANGUAGE_STANDARD = gnu99; 339 | GCC_DYNAMIC_NO_PIC = NO; 340 | GCC_NO_COMMON_BLOCKS = YES; 341 | GCC_OPTIMIZATION_LEVEL = 0; 342 | GCC_PREPROCESSOR_DEFINITIONS = ( 343 | "DEBUG=1", 344 | "$(inherited)", 345 | ); 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 353 | MTL_ENABLE_DEBUG_INFO = YES; 354 | ONLY_ACTIVE_ARCH = YES; 355 | SDKROOT = iphoneos; 356 | TARGETED_DEVICE_FAMILY = "1,2"; 357 | }; 358 | name = Debug; 359 | }; 360 | 97C147041CF9000F007C117D /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_ANALYZER_NONNULL = YES; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_COMMA = YES; 372 | CLANG_WARN_CONSTANT_CONVERSION = YES; 373 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 374 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 375 | CLANG_WARN_EMPTY_BODY = YES; 376 | CLANG_WARN_ENUM_CONVERSION = YES; 377 | CLANG_WARN_INFINITE_RECURSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 380 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 381 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 383 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 384 | CLANG_WARN_STRICT_PROTOTYPES = YES; 385 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 389 | COPY_PHASE_STRIP = NO; 390 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 391 | ENABLE_NS_ASSERTIONS = NO; 392 | ENABLE_STRICT_OBJC_MSGSEND = YES; 393 | GCC_C_LANGUAGE_STANDARD = gnu99; 394 | GCC_NO_COMMON_BLOCKS = YES; 395 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 396 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 397 | GCC_WARN_UNDECLARED_SELECTOR = YES; 398 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 399 | GCC_WARN_UNUSED_FUNCTION = YES; 400 | GCC_WARN_UNUSED_VARIABLE = YES; 401 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 402 | MTL_ENABLE_DEBUG_INFO = NO; 403 | SDKROOT = iphoneos; 404 | SUPPORTED_PLATFORMS = iphoneos; 405 | SWIFT_COMPILATION_MODE = wholemodule; 406 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 407 | TARGETED_DEVICE_FAMILY = "1,2"; 408 | VALIDATE_PRODUCT = YES; 409 | }; 410 | name = Release; 411 | }; 412 | 97C147061CF9000F007C117D /* Debug */ = { 413 | isa = XCBuildConfiguration; 414 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | CLANG_ENABLE_MODULES = YES; 418 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 419 | ENABLE_BITCODE = NO; 420 | INFOPLIST_FILE = Runner/Info.plist; 421 | LD_RUNPATH_SEARCH_PATHS = ( 422 | "$(inherited)", 423 | "@executable_path/Frameworks", 424 | ); 425 | PRODUCT_BUNDLE_IDENTIFIER = com.example.videoStreaming; 426 | PRODUCT_NAME = "$(TARGET_NAME)"; 427 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | SWIFT_VERSION = 5.0; 430 | VERSIONING_SYSTEM = "apple-generic"; 431 | }; 432 | name = Debug; 433 | }; 434 | 97C147071CF9000F007C117D /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CLANG_ENABLE_MODULES = YES; 440 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 441 | ENABLE_BITCODE = NO; 442 | INFOPLIST_FILE = Runner/Info.plist; 443 | LD_RUNPATH_SEARCH_PATHS = ( 444 | "$(inherited)", 445 | "@executable_path/Frameworks", 446 | ); 447 | PRODUCT_BUNDLE_IDENTIFIER = com.example.videoStreaming; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 450 | SWIFT_VERSION = 5.0; 451 | VERSIONING_SYSTEM = "apple-generic"; 452 | }; 453 | name = Release; 454 | }; 455 | /* End XCBuildConfiguration section */ 456 | 457 | /* Begin XCConfigurationList section */ 458 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147031CF9000F007C117D /* Debug */, 462 | 97C147041CF9000F007C117D /* Release */, 463 | 249021D3217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 469 | isa = XCConfigurationList; 470 | buildConfigurations = ( 471 | 97C147061CF9000F007C117D /* Debug */, 472 | 97C147071CF9000F007C117D /* Release */, 473 | 249021D4217E4FDB00AE95B9 /* Profile */, 474 | ); 475 | defaultConfigurationIsVisible = 0; 476 | defaultConfigurationName = Release; 477 | }; 478 | /* End XCConfigurationList section */ 479 | }; 480 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 481 | } 482 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/What-the-Flutter/Flutter-WebRTC/f7bd0a968e2d75cb4dcf8d00568d5854e5fb05ad/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSCameraUsageDescription 6 | $(PRODUCT_NAME) Camera Usage! 7 | NSMicrophoneUsageDescription 8 | $(PRODUCT_NAME) Microphone Usage! 9 | CFBundleDevelopmentRegion 10 | $(DEVELOPMENT_LANGUAGE) 11 | CFBundleDisplayName 12 | Video Streaming 13 | CFBundleExecutable 14 | $(EXECUTABLE_NAME) 15 | CFBundleIdentifier 16 | $(PRODUCT_BUNDLE_IDENTIFIER) 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundleName 20 | video_streaming 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | $(FLUTTER_BUILD_NAME) 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | $(FLUTTER_BUILD_NUMBER) 29 | LSRequiresIPhoneOS 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UIViewControllerBasedStatusBarAppearance 49 | 50 | CADisableMinimumFrameDurationOnPhone 51 | 52 | UIApplicationSupportsIndirectInputEvents 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/data/datasources/remote_datasource.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter_webrtc/flutter_webrtc.dart'; 3 | 4 | class RemoteDataSource { 5 | final FirebaseFirestore _db = FirebaseFirestore.instance; 6 | 7 | static const String _roomsCollection = 'rooms'; 8 | static const String _candidatesCollection = 'candidates'; 9 | static const String _candidateUidField = 'uid'; 10 | 11 | String? userId; 12 | 13 | Future createRoom({required RTCSessionDescription offer}) async { 14 | final roomRef = _db.collection(_roomsCollection).doc(); 15 | final roomWithOffer = {'offer': offer.toMap()}; 16 | 17 | await roomRef.set(roomWithOffer); 18 | return roomRef.id; 19 | } 20 | 21 | Future deleteRoom({required String roomId}) => 22 | _db.collection(_roomsCollection).doc(roomId).delete(); 23 | 24 | Future setAnswer({ 25 | required String roomId, 26 | required RTCSessionDescription answer, 27 | }) async { 28 | final roomRef = _db.collection(_roomsCollection).doc(roomId); 29 | final roomWithAnswer = { 30 | 'answer': {'type': answer.type, 'sdp': answer.sdp} 31 | }; 32 | await roomRef.update(roomWithAnswer); 33 | } 34 | 35 | Future getRoomOfferIfExists({required String roomId}) async { 36 | final roomDoc = await _db.collection(_roomsCollection).doc(roomId).get(); 37 | if (!roomDoc.exists) { 38 | return null; 39 | } else { 40 | final data = roomDoc.data() as Map; 41 | final offer = data['offer']; 42 | return RTCSessionDescription(offer['sdp'], offer['type']); 43 | } 44 | } 45 | 46 | Stream getRoomDataStream({required String roomId}) { 47 | final snapshots = _db.collection(_roomsCollection).doc(roomId).snapshots(); 48 | final filteredStream = snapshots.map((snapshot) => snapshot.data()); 49 | return filteredStream.map( 50 | (data) { 51 | if (data != null && data['answer'] != null) { 52 | return RTCSessionDescription( 53 | data['answer']['sdp'], 54 | data['answer']['type'], 55 | ); 56 | } else { 57 | return null; 58 | } 59 | }, 60 | ); 61 | } 62 | 63 | Stream> getCandidatesAddedToRoomStream({ 64 | required String roomId, 65 | required bool listenCaller, 66 | }) { 67 | final snapshots = _db 68 | .collection(_roomsCollection) 69 | .doc(roomId) 70 | .collection(_candidatesCollection) 71 | .where(_candidateUidField, isNotEqualTo: userId) 72 | .snapshots(); 73 | 74 | final convertedStream = snapshots.map( 75 | (snapshot) { 76 | final docChangesList = listenCaller 77 | ? snapshot.docChanges 78 | : snapshot.docChanges.where((change) => change.type == DocumentChangeType.added); 79 | return docChangesList.map((change) { 80 | final data = change.doc.data() as Map; 81 | return RTCIceCandidate( 82 | data['candidate'], 83 | data['sdpMid'], 84 | data['sdpMLineIndex'], 85 | ); 86 | }).toList(); 87 | }, 88 | ); 89 | 90 | return convertedStream; 91 | } 92 | 93 | Future addCandidateToRoom({ 94 | required String roomId, 95 | required RTCIceCandidate candidate, 96 | }) async { 97 | final roomRef = _db.collection(_roomsCollection).doc(roomId); 98 | final candidatesCollection = roomRef.collection(_candidatesCollection); 99 | await candidatesCollection.add(candidate.toMap()..[_candidateUidField] = userId); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/data/repositories/auth_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_auth/firebase_auth.dart'; 2 | import 'package:video_streaming/data/datasources/remote_datasource.dart'; 3 | import 'package:video_streaming/domain/repositories/auth_repository.dart'; 4 | import 'package:video_streaming/utils/logger.dart'; 5 | 6 | class AuthRepository implements AuthRepositoryInt { 7 | final RemoteDataSource _remoteDatasource; 8 | 9 | AuthRepository(this._remoteDatasource); 10 | 11 | @override 12 | Future signInAnonymously() async { 13 | try { 14 | final userCredential = await FirebaseAuth.instance.signInAnonymously(); 15 | _remoteDatasource.userId = userCredential.user?.uid; 16 | } on FirebaseAuthException catch (e) { 17 | switch (e.code) { 18 | case 'operation-not-allowed': 19 | Logger.printRed( 20 | message: 'Anonymous auth hasn\'t been enabled for this project', 21 | filename: 'auth_repository', 22 | method: 'signInAnonymously', 23 | line: 18, 24 | ); 25 | break; 26 | default: 27 | Logger.printRed( 28 | message: 'Unknown error', 29 | filename: 'auth_repository', 30 | method: 'signInAnonymously', 31 | line: 26, 32 | ); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/data/repositories/room_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_webrtc/flutter_webrtc.dart'; 2 | import 'package:video_streaming/data/datasources/remote_datasource.dart'; 3 | import 'package:video_streaming/domain/repositories/room_repository.dart'; 4 | 5 | class RoomRepository implements RoomRepositoryInt { 6 | final RemoteDataSource _remoteDatasource; 7 | 8 | RoomRepository(this._remoteDatasource); 9 | 10 | @override 11 | Future createRoom({required RTCSessionDescription offer}) => 12 | _remoteDatasource.createRoom(offer: offer); 13 | 14 | @override 15 | Future deleteRoom({required String roomId}) => _remoteDatasource.deleteRoom(roomId: roomId); 16 | 17 | @override 18 | Future addCandidateToRoom({ 19 | required String roomId, 20 | required RTCIceCandidate candidate, 21 | }) => 22 | _remoteDatasource.addCandidateToRoom(roomId: roomId, candidate: candidate); 23 | 24 | @override 25 | Future getRoomOfferIfExists({required String roomId}) => 26 | _remoteDatasource.getRoomOfferIfExists(roomId: roomId); 27 | 28 | @override 29 | Future setAnswer({required String roomId, required RTCSessionDescription answer}) => 30 | _remoteDatasource.setAnswer(roomId: roomId, answer: answer); 31 | 32 | @override 33 | Stream getRoomDataStream({required String roomId}) => 34 | _remoteDatasource.getRoomDataStream(roomId: roomId); 35 | 36 | @override 37 | Stream> getCandidatesAddedToRoomStream({ 38 | required String roomId, 39 | required bool listenCaller, 40 | }) => 41 | _remoteDatasource.getCandidatesAddedToRoomStream( 42 | roomId: roomId, 43 | listenCaller: listenCaller, 44 | ); 45 | } 46 | -------------------------------------------------------------------------------- /lib/di/cubit_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:video_streaming/di/injector.dart'; 2 | import 'package:video_streaming/presentation/pages/webrtc/webrtc_cubit.dart'; 3 | 4 | void initCubitModule() { 5 | i.registerFactory(() => WebrtcCubit(i.get())); 6 | } 7 | -------------------------------------------------------------------------------- /lib/di/data_source_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:video_streaming/data/datasources/remote_datasource.dart'; 2 | import 'package:video_streaming/di/injector.dart'; 3 | 4 | void initDataSourceModule() { 5 | i.registerSingleton( 6 | RemoteDataSource(), 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /lib/di/injector.dart: -------------------------------------------------------------------------------- 1 | import 'package:get_it/get_it.dart'; 2 | import 'package:video_streaming/di/cubit_module.dart'; 3 | import 'package:video_streaming/di/data_source_module.dart'; 4 | import 'package:video_streaming/di/interactor_module.dart'; 5 | import 'package:video_streaming/di/repository_module.dart'; 6 | 7 | GetIt get i => GetIt.instance; 8 | 9 | void initInjector() { 10 | initDataSourceModule(); 11 | initRepositoryModule(); 12 | initInteractorModule(); 13 | initCubitModule(); 14 | } 15 | -------------------------------------------------------------------------------- /lib/di/interactor_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:video_streaming/di/injector.dart'; 2 | import 'package:video_streaming/domain/interactors/webrtc_interactor.dart'; 3 | 4 | void initInteractorModule() { 5 | i.registerFactory(() => WebrtcInteractor(i.get())); 6 | } 7 | -------------------------------------------------------------------------------- /lib/di/repository_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:video_streaming/data/repositories/auth_repository.dart'; 2 | import 'package:video_streaming/data/repositories/room_repository.dart'; 3 | import 'package:video_streaming/di/injector.dart'; 4 | import 'package:video_streaming/domain/repositories/auth_repository.dart'; 5 | import 'package:video_streaming/domain/repositories/room_repository.dart'; 6 | 7 | void initRepositoryModule() { 8 | i.registerSingleton(RoomRepository(i.get())); 9 | i.registerSingleton(AuthRepository(i.get())); 10 | } 11 | -------------------------------------------------------------------------------- /lib/domain/interactors/webrtc_interactor.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_webrtc/flutter_webrtc.dart'; 2 | import 'package:video_streaming/domain/repositories/room_repository.dart'; 3 | 4 | class WebrtcInteractor { 5 | final RoomRepositoryInt _roomRepository; 6 | 7 | WebrtcInteractor(this._roomRepository); 8 | 9 | Future createRoom({required RTCSessionDescription offer}) => 10 | _roomRepository.createRoom(offer: offer); 11 | 12 | Future deleteRoom({required String roomId}) => _roomRepository.deleteRoom(roomId: roomId); 13 | 14 | Future addCandidateToRoom({required String roomId, required RTCIceCandidate candidate}) => 15 | _roomRepository.addCandidateToRoom(roomId: roomId, candidate: candidate); 16 | 17 | Future getRoomOfferIfExists({required String roomId}) => 18 | _roomRepository.getRoomOfferIfExists(roomId: roomId); 19 | 20 | Future setAnswer({required String roomId, required RTCSessionDescription answer}) => 21 | _roomRepository.setAnswer(roomId: roomId, answer: answer); 22 | 23 | Stream getRoomDataStream({required String roomId}) => 24 | _roomRepository.getRoomDataStream(roomId: roomId); 25 | 26 | Stream> getCandidatesAddedToRoomStream({ 27 | required String roomId, 28 | required bool listenCaller, 29 | }) => 30 | _roomRepository.getCandidatesAddedToRoomStream(roomId: roomId, listenCaller: listenCaller); 31 | } 32 | -------------------------------------------------------------------------------- /lib/domain/repositories/auth_repository.dart: -------------------------------------------------------------------------------- 1 | abstract class AuthRepositoryInt { 2 | Future signInAnonymously(); 3 | } 4 | -------------------------------------------------------------------------------- /lib/domain/repositories/room_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_webrtc/flutter_webrtc.dart'; 2 | 3 | abstract class RoomRepositoryInt { 4 | Future createRoom({required RTCSessionDescription offer}); 5 | 6 | Future deleteRoom({required String roomId}); 7 | 8 | Future addCandidateToRoom({required String roomId, required RTCIceCandidate candidate}); 9 | 10 | Future getRoomOfferIfExists({required String roomId}); 11 | 12 | Future setAnswer({required String roomId, required RTCSessionDescription answer}); 13 | 14 | Stream getRoomDataStream({required String roomId}); 15 | 16 | Stream> getCandidatesAddedToRoomStream({ 17 | required String roomId, 18 | required bool listenCaller, 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_core/firebase_core.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:video_streaming/di/injector.dart'; 4 | import 'package:video_streaming/domain/repositories/auth_repository.dart'; 5 | import 'package:video_streaming/presentation/app/app.dart'; 6 | 7 | void main() async { 8 | WidgetsFlutterBinding.ensureInitialized(); 9 | await Firebase.initializeApp(); 10 | initInjector(); 11 | await i.get().signInAnonymously(); 12 | runApp(const VideoStreamingApp()); 13 | } 14 | -------------------------------------------------------------------------------- /lib/presentation/app/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:video_streaming/presentation/pages/webrtc/webrtc_page.dart'; 3 | 4 | class VideoStreamingApp extends StatelessWidget { 5 | const VideoStreamingApp({super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return MaterialApp( 10 | theme: ThemeData( 11 | primarySwatch: Colors.blue, 12 | ), 13 | home: WebrtcPage(), 14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/presentation/pages/webrtc/webrtc_cubit.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:flutter_webrtc/flutter_webrtc.dart'; 5 | import 'package:video_streaming/domain/interactors/webrtc_interactor.dart'; 6 | import 'package:video_streaming/presentation/pages/webrtc/webrtc_state.dart'; 7 | import 'package:video_streaming/utils/logger.dart'; 8 | 9 | class WebrtcCubit extends Cubit { 10 | static final WebrtcState _initialState = WebrtcState(); 11 | 12 | static const Map _configuration = { 13 | 'iceServers': [ 14 | { 15 | 'urls': [ 16 | 'stun:stun1.l.google.com:19302', 17 | 'stun:stun2.l.google.com:19302', 18 | ], 19 | }, 20 | ], 21 | }; 22 | 23 | final WebrtcInteractor _interactor; 24 | final List _subscriptions = []; 25 | 26 | WebrtcCubit(this._interactor) : super(_initialState); 27 | 28 | Future createRoom() async { 29 | await _createPeerConnection(); 30 | 31 | final offer = await state.peerConnection!.createOffer(); 32 | final roomId = await _interactor.createRoom(offer: offer); 33 | _registerPeerConnectionListeners(roomId); 34 | 35 | state.localStream?.getTracks().forEach((track) { 36 | state.peerConnection!.addTrack(track, state.localStream!); 37 | }); 38 | 39 | Logger.printGreen( 40 | message: 'Room $roomId created with offer', 41 | filename: 'webrtc_cubit', 42 | method: 'createRoom', 43 | line: 39, 44 | ); 45 | emit(state.copyWith(roomId: roomId)); 46 | 47 | await state.peerConnection!.setLocalDescription(offer); 48 | 49 | _subscriptions.addAll([ 50 | _interactor.getRoomDataStream(roomId: roomId).listen((answer) async { 51 | if (answer != null) { 52 | state.peerConnection?.setRemoteDescription(answer); 53 | } else { 54 | if (state.remoteStream != null) { 55 | emit(state.copyWith(clearAll: true)); 56 | } 57 | } 58 | }), 59 | _interactor.getCandidatesAddedToRoomStream(roomId: roomId, listenCaller: false).listen( 60 | (candidates) { 61 | for (final candidate in candidates) { 62 | state.peerConnection?.addCandidate(candidate); 63 | } 64 | }, 65 | ), 66 | ]); 67 | } 68 | 69 | Future joinRoom(String roomId) async { 70 | final sessionDescription = await _interactor.getRoomOfferIfExists(roomId: roomId); 71 | 72 | if (sessionDescription != null) { 73 | await _createPeerConnection(); 74 | 75 | _registerPeerConnectionListeners(roomId); 76 | 77 | state.localStream?.getTracks().forEach((track) { 78 | state.peerConnection!.addTrack(track, state.localStream!); 79 | }); 80 | 81 | await state.peerConnection!.setRemoteDescription(sessionDescription); 82 | final answer = await state.peerConnection!.createAnswer(); 83 | Logger.printYellow( 84 | message: 'Answer (Session Description Protocol package) created', 85 | filename: 'webrtc_cubit', 86 | method: 'joinRoom', 87 | line: 82, 88 | ); 89 | 90 | await state.peerConnection!.setLocalDescription(answer); 91 | await _interactor.setAnswer(roomId: roomId, answer: answer); 92 | 93 | _subscriptions.addAll( 94 | [ 95 | _interactor.getCandidatesAddedToRoomStream(roomId: roomId, listenCaller: true).listen( 96 | (candidates) { 97 | for (final candidate in candidates) { 98 | state.peerConnection?.addCandidate(candidate); 99 | } 100 | }, 101 | ), 102 | _interactor.getRoomDataStream(roomId: roomId).listen( 103 | (answer) async { 104 | if (answer == null) { 105 | emit(state.copyWith(clearAll: true)); 106 | } 107 | }, 108 | ), 109 | ], 110 | ); 111 | } 112 | } 113 | 114 | Future _createPeerConnection() async { 115 | final peerConnection = await createPeerConnection(_configuration); 116 | Logger.printGreen( 117 | message: 'Peer Connection created', 118 | filename: 'webrtc_cubit', 119 | method: 'createRoom', 120 | line: 115, 121 | ); 122 | emit(state.copyWith(peerConnection: peerConnection)); 123 | } 124 | 125 | Future enableUserMediaStream() async { 126 | var stream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); 127 | emit( 128 | state.copyWith( 129 | localStream: stream, 130 | currentUserShown: true, 131 | ), 132 | ); 133 | } 134 | 135 | void enableVideo() { 136 | if (state.videoDisabled) { 137 | state.localStream?.getVideoTracks().forEach((track) => track.enabled = true); 138 | emit(state.copyWith(videoDisabled: false)); 139 | } 140 | } 141 | 142 | void disableVideo() { 143 | if (!state.videoDisabled) { 144 | state.localStream?.getVideoTracks().forEach((track) => track.enabled = false); 145 | emit(state.copyWith(videoDisabled: true)); 146 | } 147 | } 148 | 149 | void enableAudio() { 150 | if (state.audioDisabled) { 151 | state.localStream?.getAudioTracks().forEach((track) => track.enabled = true); 152 | emit(state.copyWith(audioDisabled: false)); 153 | } 154 | } 155 | 156 | void disableAudio() { 157 | if (!state.audioDisabled) { 158 | state.localStream?.getAudioTracks().forEach((track) => track.enabled = false); 159 | emit(state.copyWith(audioDisabled: true)); 160 | } 161 | } 162 | 163 | Future hangUp(RTCVideoRenderer localVideo) async { 164 | final tracks = localVideo.srcObject!.getTracks(); 165 | for (var track in tracks) { 166 | track.stop(); 167 | } 168 | 169 | if (state.remoteStream != null) { 170 | state.remoteStream!.getTracks().forEach((track) => track.stop()); 171 | } 172 | if (state.peerConnection != null) state.peerConnection!.close(); 173 | 174 | if (state.roomId != null) { 175 | _interactor.deleteRoom(roomId: state.roomId!); 176 | } 177 | 178 | state.localStream!.dispose(); 179 | state.remoteStream?.dispose(); 180 | 181 | for (final subs in _subscriptions) { 182 | subs.cancel(); 183 | } 184 | _subscriptions.clear(); 185 | 186 | emit(state.copyWith(clearAll: true)); 187 | } 188 | 189 | void _registerPeerConnectionListeners(String roomId) { 190 | state.peerConnection!.onIceCandidate = (candidate) { 191 | Logger.printCyan( 192 | message: 'ICE candidate received: ${candidate.candidate}', 193 | filename: 'webrtc_cubit', 194 | method: 'joinRoom(onIceCandidate)', 195 | line: 190, 196 | ); 197 | _interactor.addCandidateToRoom(roomId: roomId, candidate: candidate); 198 | }; 199 | 200 | state.peerConnection!.onAddStream = (stream) { 201 | Logger.printBlue( 202 | message: 'Remote stream added', 203 | filename: 'webrtc_cubit', 204 | method: '_registerPeerConnectionListeners', 205 | line: 200, 206 | ); 207 | emit(state.copyWith(remoteStream: stream, companionShown: true)); 208 | }; 209 | 210 | state.peerConnection!.onTrack = (event) { 211 | Logger.printCyan( 212 | message: 'Track is added to the connection', 213 | filename: 'webrtc_cubit', 214 | method: 'joinRoom(onTrack)', 215 | line: 210, 216 | ); 217 | event.streams[0].getTracks().forEach((track) => state.remoteStream?.addTrack(track)); 218 | }; 219 | } 220 | } 221 | -------------------------------------------------------------------------------- /lib/presentation/pages/webrtc/webrtc_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:flutter_webrtc/flutter_webrtc.dart'; 4 | import 'package:video_streaming/di/injector.dart'; 5 | import 'package:video_streaming/presentation/pages/webrtc/webrtc_cubit.dart'; 6 | import 'package:video_streaming/presentation/pages/webrtc/webrtc_state.dart'; 7 | 8 | class WebrtcPage extends StatefulWidget { 9 | WebrtcPage({Key? key}) : super(key: key); 10 | 11 | @override 12 | _WebrtcPageState createState() => _WebrtcPageState(); 13 | } 14 | 15 | class _WebrtcPageState extends State { 16 | static const int roomIdLength = 20; 17 | static const double _defaultPadding = 20; 18 | 19 | final WebrtcCubit _cubit = i.get(); 20 | 21 | final RTCVideoRenderer _localRenderer = RTCVideoRenderer(); 22 | final RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); 23 | final TextEditingController _textEditingController = TextEditingController(text: ''); 24 | 25 | @override 26 | void initState() { 27 | _localRenderer.initialize(); 28 | _remoteRenderer.initialize(); 29 | _textEditingController.addListener(() => setState(() {})); 30 | super.initState(); 31 | } 32 | 33 | @override 34 | void dispose() { 35 | _localRenderer.dispose(); 36 | _remoteRenderer.dispose(); 37 | super.dispose(); 38 | } 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | return BlocConsumer( 43 | bloc: _cubit, 44 | listenWhen: (prev, next) => 45 | prev.localStream != next.localStream || 46 | prev.remoteStream != next.remoteStream || 47 | prev.roomId != next.roomId || 48 | next.cleared, 49 | listener: (context, state) { 50 | if (state.cleared) { 51 | _localRenderer.initialize(); 52 | _remoteRenderer.initialize(); 53 | _textEditingController.text = ''; 54 | } else { 55 | if (state.localStream != null || _localRenderer.srcObject != state.localStream) { 56 | _localRenderer.srcObject = state.localStream!; 57 | } 58 | if (state.remoteStream != null || _remoteRenderer.srcObject != state.remoteStream) { 59 | _remoteRenderer.srcObject = state.remoteStream!; 60 | } 61 | if (state.roomId != null && state.roomId != _textEditingController.text) { 62 | _textEditingController.text = state.roomId!; 63 | } 64 | } 65 | setState(() {}); 66 | }, 67 | builder: (context, state) { 68 | return Scaffold( 69 | body: _getContent(state), 70 | ); 71 | }, 72 | ); 73 | } 74 | 75 | Widget _getContent(WebrtcState state) { 76 | if (state.currentUserShown && state.companionShown) { 77 | return _fullConversation( 78 | cameraEnabled: !state.videoDisabled, 79 | microEnabled: !state.audioDisabled, 80 | ); 81 | } else if (state.currentUserShown) { 82 | return _myVideoFullScreen( 83 | cameraEnabled: !state.videoDisabled, 84 | microEnabled: !state.audioDisabled, 85 | ); 86 | } else { 87 | return _emptyPage(); 88 | } 89 | } 90 | 91 | Widget _emptyPage() { 92 | final buttonIsNotActive = 93 | _textEditingController.text.isEmpty || _textEditingController.text.length != roomIdLength; 94 | 95 | return Center( 96 | child: Column( 97 | mainAxisAlignment: MainAxisAlignment.center, 98 | crossAxisAlignment: CrossAxisAlignment.center, 99 | children: [ 100 | ElevatedButton( 101 | onPressed: () async { 102 | await _cubit.enableUserMediaStream(); 103 | await _cubit.createRoom(); 104 | setState(() {}); 105 | }, 106 | child: const Text('Open camera and Create room'), 107 | ), 108 | const SizedBox(height: 32), 109 | const Text('Join the following Room: '), 110 | SizedBox( 111 | width: MediaQuery.of(context).size.width * 0.7, 112 | child: TextField( 113 | maxLength: roomIdLength, 114 | controller: _textEditingController, 115 | ), 116 | ), 117 | const SizedBox(height: 8), 118 | ElevatedButton( 119 | style: buttonIsNotActive 120 | ? null 121 | : const ButtonStyle().copyWith( 122 | backgroundColor: const MaterialStatePropertyAll(Colors.grey), 123 | ), 124 | onPressed: buttonIsNotActive 125 | ? null 126 | : () async { 127 | await _cubit.enableUserMediaStream(); 128 | _cubit.joinRoom(_textEditingController.text); 129 | }, 130 | child: const Text('Open camera and Join room'), 131 | ), 132 | ], 133 | ), 134 | ); 135 | } 136 | 137 | Widget _myVideoFullScreen({ 138 | required bool cameraEnabled, 139 | required bool microEnabled, 140 | }) { 141 | return Stack( 142 | children: [ 143 | Positioned.fill( 144 | child: RTCVideoView( 145 | _localRenderer, 146 | mirror: true, 147 | objectFit: RTCVideoViewObjectFit.RTCVideoViewObjectFitCover, 148 | ), 149 | ), 150 | Positioned( 151 | top: MediaQuery.of(context).viewPadding.top, 152 | left: 0, 153 | right: 0, 154 | child: TextField( 155 | readOnly: true, 156 | textAlign: TextAlign.center, 157 | controller: _textEditingController, 158 | decoration: const InputDecoration( 159 | border: InputBorder.none, 160 | focusedBorder: InputBorder.none, 161 | ), 162 | ), 163 | ), 164 | Positioned( 165 | bottom: _defaultPadding, 166 | left: 0, 167 | right: 0, 168 | child: Row( 169 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 170 | children: [ 171 | ..._mediaButtons(cameraEnabled: cameraEnabled, microEnabled: microEnabled), 172 | _endCallButton(), 173 | ], 174 | ), 175 | ), 176 | ], 177 | ); 178 | } 179 | 180 | Widget _fullConversation({ 181 | required bool cameraEnabled, 182 | required bool microEnabled, 183 | }) { 184 | const previewSize = 0.3; 185 | final previewWidth = MediaQuery.of(context).size.width * previewSize; 186 | return Stack( 187 | children: [ 188 | Positioned.fill( 189 | child: RTCVideoView( 190 | _remoteRenderer, 191 | mirror: false, 192 | objectFit: RTCVideoViewObjectFit.RTCVideoViewObjectFitCover, 193 | ), 194 | ), 195 | Positioned( 196 | right: _defaultPadding, 197 | bottom: _defaultPadding, 198 | child: Container( 199 | width: previewWidth, 200 | height: previewWidth * _localRenderer.videoWidth / _localRenderer.videoHeight, 201 | decoration: BoxDecoration( 202 | borderRadius: const BorderRadius.all(Radius.circular(10)), 203 | border: Border.all(color: Colors.blueAccent), 204 | ), 205 | clipBehavior: Clip.hardEdge, 206 | child: RTCVideoView( 207 | _localRenderer, 208 | mirror: true, 209 | objectFit: RTCVideoViewObjectFit.RTCVideoViewObjectFitCover, 210 | ), 211 | ), 212 | ), 213 | Positioned( 214 | bottom: _defaultPadding, 215 | left: 0, 216 | right: 0, 217 | child: Row( 218 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 219 | children: [ 220 | ..._mediaButtons(cameraEnabled: cameraEnabled, microEnabled: microEnabled), 221 | _endCallButton(), 222 | ], 223 | ), 224 | ), 225 | ], 226 | ); 227 | } 228 | 229 | Widget _endCallButton() { 230 | return FloatingActionButton( 231 | onPressed: () => _cubit.hangUp(_localRenderer), 232 | backgroundColor: Colors.red, 233 | child: const Icon( 234 | Icons.phone, 235 | color: Colors.white, 236 | ), 237 | ); 238 | } 239 | 240 | List _mediaButtons({required bool microEnabled, required bool cameraEnabled}) { 241 | return [ 242 | FloatingActionButton( 243 | onPressed: () { 244 | if (cameraEnabled) { 245 | _cubit.disableVideo(); 246 | } else { 247 | _cubit.enableVideo(); 248 | } 249 | }, 250 | backgroundColor: cameraEnabled ? Colors.blueAccent : Colors.white, 251 | child: Icon( 252 | cameraEnabled ? Icons.videocam : Icons.videocam_off, 253 | color: cameraEnabled ? Colors.white : Colors.red, 254 | ), 255 | ), 256 | FloatingActionButton( 257 | onPressed: () { 258 | if (microEnabled) { 259 | _cubit.disableAudio(); 260 | } else { 261 | _cubit.enableAudio(); 262 | } 263 | }, 264 | backgroundColor: microEnabled ? Colors.blueAccent : Colors.white, 265 | child: Icon( 266 | microEnabled ? Icons.mic : Icons.mic_off, 267 | color: microEnabled ? Colors.white : Colors.red, 268 | ), 269 | ), 270 | ]; 271 | } 272 | } 273 | -------------------------------------------------------------------------------- /lib/presentation/pages/webrtc/webrtc_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_webrtc/flutter_webrtc.dart'; 2 | 3 | class WebrtcState { 4 | final String? roomId; 5 | final MediaStream? localStream; 6 | final MediaStream? remoteStream; 7 | final RTCPeerConnection? peerConnection; 8 | final bool cleared; 9 | final bool currentUserShown; 10 | final bool companionShown; 11 | final bool videoDisabled; 12 | final bool audioDisabled; 13 | final bool microMuted; 14 | 15 | WebrtcState({ 16 | this.roomId, 17 | this.localStream, 18 | this.remoteStream, 19 | this.peerConnection, 20 | this.cleared = false, 21 | this.currentUserShown = false, 22 | this.companionShown = false, 23 | this.videoDisabled = false, 24 | this.audioDisabled = false, 25 | this.microMuted = false, 26 | }); 27 | 28 | WebrtcState copyWith({ 29 | String? roomId, 30 | MediaStream? localStream, 31 | MediaStream? remoteStream, 32 | RTCPeerConnection? peerConnection, 33 | bool? currentUserShown, 34 | bool? companionShown, 35 | bool? videoDisabled, 36 | bool? audioDisabled, 37 | bool? microMuted, 38 | bool clearCurrentRoomText = false, 39 | bool clearRoomId = false, 40 | bool clearLocalStream = false, 41 | bool clearRemoteStream = false, 42 | bool clearPeerConnection = false, 43 | bool clearAll = false, 44 | }) { 45 | return WebrtcState( 46 | cleared: clearAll, 47 | roomId: clearAll || clearRoomId ? null : roomId ?? this.roomId, 48 | localStream: clearAll || clearLocalStream ? null : localStream ?? this.localStream, 49 | remoteStream: clearAll || clearRemoteStream ? null : remoteStream ?? this.remoteStream, 50 | peerConnection: 51 | clearAll || clearPeerConnection ? null : peerConnection ?? this.peerConnection, 52 | currentUserShown: clearAll ? false : (currentUserShown ?? this.currentUserShown), 53 | companionShown: clearAll ? false : (companionShown ?? this.companionShown), 54 | videoDisabled: clearAll ? false : (videoDisabled ?? this.videoDisabled), 55 | audioDisabled: clearAll ? false : (audioDisabled ?? this.audioDisabled), 56 | microMuted: clearAll ? false : (microMuted ?? this.microMuted), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/utils/logger.dart: -------------------------------------------------------------------------------- 1 | abstract class Logger { 2 | static void printRed({required String message, String? filename, String? method, int? line}) => 3 | _print(message, 31, filename, method, line); 4 | 5 | static void printGreen({required String message, String? filename, String? method, int? line}) => 6 | _print(message, 32, filename, method, line); 7 | 8 | static void printYellow({required String message, String? filename, String? method, int? line}) => 9 | _print(message, 33, filename, method, line); 10 | 11 | static void printBlue({required String message, String? filename, String? method, int? line}) => 12 | _print(message, 34, filename, method, line); 13 | 14 | static void printMagenta({ 15 | required String message, 16 | String? filename, 17 | String? method, 18 | int? line, 19 | }) => 20 | _print(message, 35, filename, method, line); 21 | 22 | static void printCyan({required String message, String? filename, String? method, int? line}) => 23 | _print(message, 36, filename, method, line); 24 | 25 | static void _print(String message, int colorCode, String? file, String? method, int? line) { 26 | assert((file == null && line == null && method == null) || 27 | (file != null && line != null && method != null)); 28 | final fileWithLine = file == null ? '' : '$file - $method:$line - '; 29 | print('\x1b[${colorCode}m$fileWithLine$message\x1b[0m'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _flutterfire_internals: 5 | dependency: transitive 6 | description: 7 | name: _flutterfire_internals 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.0.8" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.9.0" 18 | bloc: 19 | dependency: transitive 20 | description: 21 | name: bloc 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "8.1.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.1.0" 32 | characters: 33 | dependency: transitive 34 | description: 35 | name: characters 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.2.1" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.1" 46 | cloud_firestore: 47 | dependency: "direct main" 48 | description: 49 | name: cloud_firestore 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "4.0.5" 53 | cloud_firestore_platform_interface: 54 | dependency: transitive 55 | description: 56 | name: cloud_firestore_platform_interface 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "5.8.5" 60 | cloud_firestore_web: 61 | dependency: transitive 62 | description: 63 | name: cloud_firestore_web 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "3.0.5" 67 | collection: 68 | dependency: transitive 69 | description: 70 | name: collection 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.16.0" 74 | csslib: 75 | dependency: transitive 76 | description: 77 | name: csslib 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "0.17.2" 81 | dart_webrtc: 82 | dependency: transitive 83 | description: 84 | name: dart_webrtc 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.0.11" 88 | fake_async: 89 | dependency: transitive 90 | description: 91 | name: fake_async 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "1.3.1" 95 | ffi: 96 | dependency: transitive 97 | description: 98 | name: ffi 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "2.0.1" 102 | file: 103 | dependency: transitive 104 | description: 105 | name: file 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "6.1.4" 109 | firebase_auth: 110 | dependency: "direct main" 111 | description: 112 | name: firebase_auth 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "4.1.2" 116 | firebase_auth_platform_interface: 117 | dependency: transitive 118 | description: 119 | name: firebase_auth_platform_interface 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "6.11.2" 123 | firebase_auth_web: 124 | dependency: transitive 125 | description: 126 | name: firebase_auth_web 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "5.1.2" 130 | firebase_core: 131 | dependency: "direct main" 132 | description: 133 | name: firebase_core 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "2.2.0" 137 | firebase_core_platform_interface: 138 | dependency: transitive 139 | description: 140 | name: firebase_core_platform_interface 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "4.5.2" 144 | firebase_core_web: 145 | dependency: transitive 146 | description: 147 | name: firebase_core_web 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "2.0.1" 151 | flutter: 152 | dependency: "direct main" 153 | description: flutter 154 | source: sdk 155 | version: "0.0.0" 156 | flutter_bloc: 157 | dependency: "direct main" 158 | description: 159 | name: flutter_bloc 160 | url: "https://pub.dartlang.org" 161 | source: hosted 162 | version: "8.1.1" 163 | flutter_lints: 164 | dependency: "direct dev" 165 | description: 166 | name: flutter_lints 167 | url: "https://pub.dartlang.org" 168 | source: hosted 169 | version: "2.0.1" 170 | flutter_test: 171 | dependency: "direct dev" 172 | description: flutter 173 | source: sdk 174 | version: "0.0.0" 175 | flutter_web_plugins: 176 | dependency: transitive 177 | description: flutter 178 | source: sdk 179 | version: "0.0.0" 180 | flutter_webrtc: 181 | dependency: "direct main" 182 | description: 183 | name: flutter_webrtc 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "0.9.16" 187 | get_it: 188 | dependency: "direct main" 189 | description: 190 | name: get_it 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "7.2.0" 194 | html: 195 | dependency: transitive 196 | description: 197 | name: html 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "0.15.1" 201 | http_parser: 202 | dependency: transitive 203 | description: 204 | name: http_parser 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "4.0.2" 208 | intl: 209 | dependency: transitive 210 | description: 211 | name: intl 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "0.17.0" 215 | js: 216 | dependency: transitive 217 | description: 218 | name: js 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "0.6.4" 222 | lints: 223 | dependency: transitive 224 | description: 225 | name: lints 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "2.0.1" 229 | matcher: 230 | dependency: transitive 231 | description: 232 | name: matcher 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "0.12.12" 236 | material_color_utilities: 237 | dependency: transitive 238 | description: 239 | name: material_color_utilities 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "0.1.5" 243 | meta: 244 | dependency: transitive 245 | description: 246 | name: meta 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.8.0" 250 | nested: 251 | dependency: transitive 252 | description: 253 | name: nested 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "1.0.0" 257 | path: 258 | dependency: transitive 259 | description: 260 | name: path 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "1.8.2" 264 | path_provider: 265 | dependency: "direct main" 266 | description: 267 | name: path_provider 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "2.0.11" 271 | path_provider_android: 272 | dependency: transitive 273 | description: 274 | name: path_provider_android 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "2.0.21" 278 | path_provider_ios: 279 | dependency: transitive 280 | description: 281 | name: path_provider_ios 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "2.0.11" 285 | path_provider_linux: 286 | dependency: transitive 287 | description: 288 | name: path_provider_linux 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "2.1.7" 292 | path_provider_macos: 293 | dependency: transitive 294 | description: 295 | name: path_provider_macos 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "2.0.6" 299 | path_provider_platform_interface: 300 | dependency: transitive 301 | description: 302 | name: path_provider_platform_interface 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "2.0.5" 306 | path_provider_windows: 307 | dependency: transitive 308 | description: 309 | name: path_provider_windows 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "2.1.3" 313 | platform: 314 | dependency: transitive 315 | description: 316 | name: platform 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "3.1.0" 320 | plugin_platform_interface: 321 | dependency: transitive 322 | description: 323 | name: plugin_platform_interface 324 | url: "https://pub.dartlang.org" 325 | source: hosted 326 | version: "2.1.3" 327 | process: 328 | dependency: transitive 329 | description: 330 | name: process 331 | url: "https://pub.dartlang.org" 332 | source: hosted 333 | version: "4.2.4" 334 | provider: 335 | dependency: transitive 336 | description: 337 | name: provider 338 | url: "https://pub.dartlang.org" 339 | source: hosted 340 | version: "6.0.4" 341 | sky_engine: 342 | dependency: transitive 343 | description: flutter 344 | source: sdk 345 | version: "0.0.99" 346 | source_span: 347 | dependency: transitive 348 | description: 349 | name: source_span 350 | url: "https://pub.dartlang.org" 351 | source: hosted 352 | version: "1.9.0" 353 | stack_trace: 354 | dependency: transitive 355 | description: 356 | name: stack_trace 357 | url: "https://pub.dartlang.org" 358 | source: hosted 359 | version: "1.10.0" 360 | stream_channel: 361 | dependency: transitive 362 | description: 363 | name: stream_channel 364 | url: "https://pub.dartlang.org" 365 | source: hosted 366 | version: "2.1.0" 367 | string_scanner: 368 | dependency: transitive 369 | description: 370 | name: string_scanner 371 | url: "https://pub.dartlang.org" 372 | source: hosted 373 | version: "1.1.1" 374 | term_glyph: 375 | dependency: transitive 376 | description: 377 | name: term_glyph 378 | url: "https://pub.dartlang.org" 379 | source: hosted 380 | version: "1.2.1" 381 | test_api: 382 | dependency: transitive 383 | description: 384 | name: test_api 385 | url: "https://pub.dartlang.org" 386 | source: hosted 387 | version: "0.4.12" 388 | typed_data: 389 | dependency: transitive 390 | description: 391 | name: typed_data 392 | url: "https://pub.dartlang.org" 393 | source: hosted 394 | version: "1.3.1" 395 | vector_math: 396 | dependency: transitive 397 | description: 398 | name: vector_math 399 | url: "https://pub.dartlang.org" 400 | source: hosted 401 | version: "2.1.2" 402 | video_player: 403 | dependency: "direct main" 404 | description: 405 | name: video_player 406 | url: "https://pub.dartlang.org" 407 | source: hosted 408 | version: "2.4.7" 409 | video_player_android: 410 | dependency: transitive 411 | description: 412 | name: video_player_android 413 | url: "https://pub.dartlang.org" 414 | source: hosted 415 | version: "2.3.9" 416 | video_player_avfoundation: 417 | dependency: transitive 418 | description: 419 | name: video_player_avfoundation 420 | url: "https://pub.dartlang.org" 421 | source: hosted 422 | version: "2.3.7" 423 | video_player_platform_interface: 424 | dependency: transitive 425 | description: 426 | name: video_player_platform_interface 427 | url: "https://pub.dartlang.org" 428 | source: hosted 429 | version: "5.1.4" 430 | video_player_web: 431 | dependency: transitive 432 | description: 433 | name: video_player_web 434 | url: "https://pub.dartlang.org" 435 | source: hosted 436 | version: "2.0.12" 437 | wakelock: 438 | dependency: "direct main" 439 | description: 440 | name: wakelock 441 | url: "https://pub.dartlang.org" 442 | source: hosted 443 | version: "0.6.2" 444 | wakelock_macos: 445 | dependency: transitive 446 | description: 447 | name: wakelock_macos 448 | url: "https://pub.dartlang.org" 449 | source: hosted 450 | version: "0.4.0" 451 | wakelock_platform_interface: 452 | dependency: transitive 453 | description: 454 | name: wakelock_platform_interface 455 | url: "https://pub.dartlang.org" 456 | source: hosted 457 | version: "0.3.0" 458 | wakelock_web: 459 | dependency: transitive 460 | description: 461 | name: wakelock_web 462 | url: "https://pub.dartlang.org" 463 | source: hosted 464 | version: "0.4.0" 465 | wakelock_windows: 466 | dependency: transitive 467 | description: 468 | name: wakelock_windows 469 | url: "https://pub.dartlang.org" 470 | source: hosted 471 | version: "0.2.1" 472 | webrtc_interface: 473 | dependency: transitive 474 | description: 475 | name: webrtc_interface 476 | url: "https://pub.dartlang.org" 477 | source: hosted 478 | version: "1.0.10" 479 | win32: 480 | dependency: transitive 481 | description: 482 | name: win32 483 | url: "https://pub.dartlang.org" 484 | source: hosted 485 | version: "3.1.1" 486 | xdg_directories: 487 | dependency: transitive 488 | description: 489 | name: xdg_directories 490 | url: "https://pub.dartlang.org" 491 | source: hosted 492 | version: "0.2.0+2" 493 | sdks: 494 | dart: ">=2.18.4 <3.0.0" 495 | flutter: ">=3.0.0" 496 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: video_streaming 2 | description: A new Flutter project. 3 | 4 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 5 | 6 | version: 1.0.0+1 7 | 8 | environment: 9 | sdk: '>=2.18.4 <3.0.0' 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | firebase_auth: ^4.1.2 16 | firebase_core: ^2.2.0 17 | flutter_bloc: ^8.1.1 18 | flutter_webrtc: ^0.9.16 19 | get_it: ^7.2.0 20 | path_provider: ^2.0.11 21 | video_player: ^2.4.7 22 | wakelock: ^0.6.2 23 | cloud_firestore: ^4.0.5 24 | 25 | dev_dependencies: 26 | flutter_test: 27 | sdk: flutter 28 | 29 | flutter_lints: ^2.0.0 30 | 31 | flutter: 32 | uses-material-design: true 33 | --------------------------------------------------------------------------------