├── .DS_Store
├── .github
├── actions
│ ├── .DS_Store
│ └── flutter-action-2.10.0
│ │ ├── .DS_Store
│ │ ├── action.yml
│ │ ├── setup.sh
│ │ └── test
│ │ ├── releases_linux.json
│ │ ├── releases_macos.json
│ │ └── releases_windows.json
├── pull_request_template.md
└── workflows
│ └── tests.yml
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── proguard-rules.pro
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── millicast_flutter_sdk
│ └── MillicastFlutterSdkPlugin.java
├── developer-info.md
├── example
├── .env.sample
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── millicast
│ │ │ │ │ └── flutter
│ │ │ │ │ └── example
│ │ │ │ │ └── MainActivity.java
│ │ │ └── res
│ │ │ │ ├── drawable-v21
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── launcher_icon.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── launcher_icon.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── launcher_icon.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── launcher_icon.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── launcher_icon.png
│ │ │ │ ├── values-night
│ │ │ │ └── styles.xml
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── assets
│ ├── HomeScreen.png
│ ├── PublisherHome.png
│ ├── PublisherSettings.png
│ ├── SubscriberHome.png
│ ├── SubscriberSettings.png
│ ├── millicastImage.png
│ ├── setCameraAndroidStudio.png
│ └── setMicAndroidEmulator.png
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── 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
│ ├── home_screen.dart
│ ├── main.dart
│ ├── millicast_publisher_user_media.dart
│ ├── publisher.dart
│ ├── publisher_settings_widget.dart
│ ├── publisher_widget.dart
│ ├── subscriber_settings_widget.dart
│ ├── subscriber_widget.dart
│ ├── utils
│ │ ├── constants.dart
│ │ └── token_response.dart
│ └── viewer.dart
├── linux
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ ├── main.cc
│ ├── my_application.cc
│ └── my_application.h
├── macos
│ ├── .gitignore
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ ├── Flutter-Release.xcconfig
│ │ └── GeneratedPluginRegistrant.swift
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── 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
│ │ ├── Base.lproj
│ │ └── MainMenu.xib
│ │ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ │ ├── DebugProfile.entitlements
│ │ ├── Info.plist
│ │ ├── MainFlutterWindow.swift
│ │ └── Release.entitlements
├── pubspec.lock
├── pubspec.yaml
├── test
│ └── widget_test.dart
└── windows
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
│ └── runner
│ ├── CMakeLists.txt
│ ├── Runner.rc
│ ├── flutter_window.cpp
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── resource.h
│ ├── resources
│ └── app_icon.ico
│ ├── runner.exe.manifest
│ ├── utils.cpp
│ ├── utils.h
│ ├── win32_window.cpp
│ └── win32_window.h
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── MillicastFlutterSdkPlugin.h
│ ├── MillicastFlutterSdkPlugin.m
│ └── SwiftMillicastFlutterSdkPlugin.swift
└── millicast_flutter_sdk.podspec
├── lib
├── millicast_flutter_sdk.dart
└── src
│ ├── config.dart
│ ├── director.dart
│ ├── logger.dart
│ ├── peer_connection.dart
│ ├── peer_connection_stats.dart
│ ├── publish.dart
│ ├── signaling.dart
│ ├── utils
│ ├── base_web_rtc.dart
│ ├── channel.dart
│ ├── fetch_error.dart
│ ├── reemit.dart
│ ├── sdp_parser.dart
│ └── transaction_manager.dart
│ └── view.dart
├── linux
├── CMakeLists.txt
├── include
│ └── millicast_flutter_sdk
│ │ └── millicast_flutter_sdk_plugin.h
└── millicast_flutter_sdk_plugin.cc
├── macos
├── Classes
│ └── MillicastFlutterSdkPlugin.swift
└── millicast_flutter_sdk.podspec
├── pubspec.yaml
├── test
├── director_test.dart
├── millicast_flutter_sdk_test.dart
├── mocks
│ ├── sdp_mock.dart
│ └── signaling_test.mocks.dart
├── publish_test.dart
├── signaling_test.dart
└── signaling_test.mocks.dart
└── windows
├── .gitignore
├── CMakeLists.txt
├── include
└── millicast_flutter_sdk
│ └── millicast_flutter_sdk_plugin_c_api.h
├── millicast_flutter_sdk_plugin.cpp
├── millicast_flutter_sdk_plugin.h
└── millicast_flutter_sdk_plugin_c_api.cpp
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/.DS_Store
--------------------------------------------------------------------------------
/.github/actions/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/.github/actions/.DS_Store
--------------------------------------------------------------------------------
/.github/actions/flutter-action-2.10.0/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/.github/actions/flutter-action-2.10.0/.DS_Store
--------------------------------------------------------------------------------
/.github/actions/flutter-action-2.10.0/action.yml:
--------------------------------------------------------------------------------
1 | name: 'Flutter action'
2 | description: 'Setup your runner with Flutter environment'
3 | author: 'Alif Rachmawadi'
4 | branding:
5 | icon: 'maximize'
6 | color: 'blue'
7 | inputs:
8 | flutter-version:
9 | description: 'The Flutter version to make available on the path'
10 | required: false
11 | default: 'any'
12 | channel:
13 | description: 'The Flutter build release channel'
14 | required: false
15 | default: 'stable'
16 | cache:
17 | description: 'Cache the Flutter SDK'
18 | required: false
19 | default: false
20 | cache-key:
21 | description: 'Identifier for the Flutter SDK cache'
22 | required: false
23 | default: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
24 | cache-path:
25 | description: 'Flutter SDK cache path'
26 | required: false
27 | default: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
28 | architecture:
29 | description: 'The architecture of Flutter SDK executable (x64 or arm64)'
30 | required: false
31 | default: '${{ runner.arch }}'
32 | outputs:
33 | CACHE-PATH:
34 | value: '${{ steps.flutter-action.outputs.CACHE-PATH }}'
35 | CACHE-KEY:
36 | value: '${{ steps.flutter-action.outputs.CACHE-KEY }}'
37 | CHANNEL:
38 | value: '${{ steps.flutter-action.outputs.CHANNEL }}'
39 | VERSION:
40 | value: '${{ steps.flutter-action.outputs.VERSION }}'
41 | ARCHITECTURE:
42 | value: '${{ steps.flutter-action.outputs.ARCHITECTURE }}'
43 | runs:
44 | using: 'composite'
45 | steps:
46 | - id: flutter-action
47 | run: $GITHUB_ACTION_PATH/setup.sh -p -c '${{ inputs.cache-path }}' -k '${{ inputs.cache-key }}' -n '${{ inputs.flutter-version }}' -a '${{ inputs.architecture }}' ${{ inputs.channel }}
48 | shell: bash
49 | - if: ${{ inputs.cache == 'true' }}
50 | uses: actions/cache@v3
51 | with:
52 | path: ${{ steps.flutter-action.outputs.CACHE-PATH }}
53 | key: ${{ steps.flutter-action.outputs.CACHE-KEY }}-${{ hashFiles('**/pubspec.lock') }}
54 | restore-keys: |
55 | ${{ steps.flutter-action.outputs.CACHE-KEY }}-${{ hashFiles('**/pubspec.lock') }}
56 | ${{ steps.flutter-action.outputs.CACHE-KEY }}
57 | - run: $GITHUB_ACTION_PATH/setup.sh -c '${{ steps.flutter-action.outputs.CACHE-PATH }}' -n '${{ steps.flutter-action.outputs.VERSION }}' -a '${{ steps.flutter-action.outputs.ARCHITECTURE }}' ${{ steps.flutter-action.outputs.CHANNEL }}
58 | shell: bash
59 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ### Type of change
2 |
3 | Please delete options that are not relevant.
4 |
5 | - [ ] Bug fix (non-breaking change which fixes an issue)
6 | - [ ] New feature (non-breaking change which adds functionality)
7 |
8 | ### New Feature Submissions:
9 |
10 | - [ ] Does your submission pass tests?
11 | - [ ] Have you lint your code locally prior to submission?
12 |
13 | ### Checklist:
14 |
15 | - [ ] I have performed a self-review of my own code
16 | - [ ] I have commented my code, particularly in hard-to-understand areas
17 | - [ ] I have made corresponding changes to the documentation
18 | - [ ] I have added tests that prove my fix is effective or that my feature works
19 | - [ ] New and existing tests pass locally with my changes
20 | - [ ] I have verified the pub score with my changes
21 |
--------------------------------------------------------------------------------
/.github/workflows/tests.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to help you get started with Actions
2 |
3 | name: Tests
4 | # Controls when the workflow will run
5 | on:
6 | # Triggers the workflow on push or pull request events but only for the develop branch
7 | push:
8 | branches: [ develop, main ]
9 | pull_request:
10 | branches: [ develop, main ]
11 |
12 | # Allows you to run this workflow manually from the Actions tab
13 | workflow_dispatch:
14 |
15 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
16 | jobs:
17 | # This workflow contains a single job called "build"
18 | build:
19 | # The type of runner that the job will run on
20 | runs-on: ubuntu-latest
21 |
22 | # Steps represent a sequence of tasks that will be executed as part of the job
23 | steps:
24 | - uses: actions/checkout@v3
25 | - uses: "./.github/actions/flutter-action-2.10.0"
26 | with:
27 | channel: 'stable'
28 | - run: flutter pub get
29 | - run: flutter test
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://www.dartlang.org/guides/libraries/private-files
2 |
3 | # Files and directories created by pub
4 | .dart_tool/
5 | .packages
6 | .flutter-plugins*
7 | build/
8 | .idea/
9 | pubspec.lock
10 | !example/pubspec.lock
11 |
12 | # Directory created by dartdoc
13 | # If you don't generate documentation locally you can remove this line.
14 | doc/api/
15 | example/web
16 | # Avoid committing generated Javascript files:
17 | *.dart.js
18 | *.info.json # Produced by the --dump-info flag.
19 | *.js # When generated by dart2js. Don't specify *.js if your
20 | # project includes source files written in JavaScript.
21 | *.js_
22 | *.js.deps
23 | *.js.map
24 |
25 | # Editor generated files/
26 | .vscode/
27 | .DS_Store
28 |
29 | # Env files
30 | *.env
31 |
32 | # IntelliJ related
33 | *.iml
34 | *.ipr
35 | *.iws
36 | .idea/
--------------------------------------------------------------------------------
/.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 and should not be manually edited.
5 |
6 | version:
7 | revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
8 | channel: stable
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### 1.2.0
2 |
3 | ### Added
4 |
5 | - Millicast Flutter SDK now allows desktop support on all three platforms MacOS, Linux, and Windows.
6 |
7 | ### Changed
8 |
9 | - Updated all dependencies to the latest resolvable versions.
10 | - Updated webRTC versions for iOS (104.5112.17) and Android (104.5112.09)
11 |
12 | ### Fixed
13 |
14 | - Fixes for Dart 3 and Flutter 3.10 support.
15 |
16 | ## 1.1.0
17 |
18 | ### Added
19 |
20 | - flutter_webrtc version upgraded to 0.9.7 (Uses WebRTC release m104).
21 |
22 | ### Changed
23 |
24 | - Now example app asks for all the permission required during startup.
25 | - Updated all dependencies to latest versions.
26 | - Updated min iOS min version 10 to 11.
27 |
28 | ### Removed
29 |
30 | - Removed uni_links dependency from example app.
31 |
32 | ## 1.0.0
33 |
34 | ## Initial stable release.
35 | ### Added
36 |
37 | - Millicast Flutter SDK now supports Flutter version 3.
38 |
39 | ### Changed
40 |
41 | - iOS example app configuration files where modified so it works out of the box in M1 macOS devices.
42 |
43 | ### Fixed
44 |
45 | - addRemoteTrack method is now properly renegotating the SDPs it now returns a valid mid transceiver both for audio/video.
46 | - Fixed a bug where viewer count where misrepresented in example app.
47 | - Flutter analyze fixes where performed to avoid warnings and info messages.
48 |
49 | ## Upgrading from 0.2.x.
50 | ## 0.2.2
51 |
52 | ### Changed
53 |
54 | - Added information needed in order to properly run the README.md Getting Started example app.
55 |
56 | ### Fixed
57 |
58 | - Moved Mockito and dotenv depenencies as dev dependencies
59 |
60 | ## 0.2.1
61 |
62 | This is the first official release of the Millicast Flutter SDK.
63 |
64 | ### Added
65 |
66 | - Now the SDK can be directly downloaded from pub.dev package repository.
67 | - getCapabilities initial implementation now returns supported video codecs.
68 |
69 | ### Changed
70 |
71 | - Example app now only renders supported codecs in the settings widget.
72 |
73 | ### Fixed
74 |
75 | - EA-Mirror-iOS-Camera: invert mirrored flag.
76 | - Bugfix/h264-support: Fallback to supported codec.
77 | - h264-support: solved codec fallback codec issue. by @fcancela in https://github.com/millicast/flutter-sdk/pull/17
78 |
79 | **Full Changelog**: https://github.com/millicast/flutter-sdk/compare/0.2.0...0.2.1
80 |
81 | ### Fixed
82 |
83 | - H264 publish on Android is device dependent.
84 |
85 | ## 0.2.0
86 |
87 | ### Added
88 |
89 | - Added support for latest version of viewercount.
90 |
91 | ### Changed
92 |
93 | - Removed support for legacy version of viewercount.
94 | - Updated README API Reference hyperlink to the proper url.
95 |
96 | ### Fixed
97 |
98 | - Fixed viewercount issues for EA.
99 | - Fixed EA iOS bug where audio could not be heard on the subscriber side.
100 | - Fixed bug where websockets were not being properly closed both for publisher/viewer.
101 | - Fixed reenabling unlimited bitrate for the SDK.
102 |
103 | **Full Changelog**: https://github.com/millicast/flutter-sdk/compare/0.1.0...0.2.0
104 |
105 | ## 0.1.0
106 |
107 | This is the first beta test release of the Millicast Flutter SDK.
108 |
109 | For SDK usage instructions, please refer to the SDK [README.md](https://github.com/millicast/flutter-sdk/tree/0.1.0#readme).
110 | An Example App (EA) at [flutter-sdk/example](https://github.com/millicast/flutter-sdk/tree/0.1.0/example) has been provided to illustrate the basic usage of the SDK.
111 | Usage of the EA is documented at its own readme at [flutter-sdk/example/README.md](https://github.com/millicast/flutter-sdk/tree/0.1.0/example#readme).
112 |
113 | There are some known issues as indicated below that are currently being worked on.
114 |
115 | Known issues:
116 |
117 | - H264 publish on Android is device dependent.
118 | - Possible workaround includes publishing with other codecs, such as VP8, VP9.
119 | - The EA has some minor issues:
120 | - On iOS, the first publish might be missing audio.
121 | - Possible workaround is to exit, reenter Publisher view, and publish again.
122 | - Viewer count might not work correctly in some scenarios.
123 | - Subscription occasionally does not terminate after leaving Subscriber view.
124 | - Possible workaround is to restart EA.
125 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | analyzer:
4 | exclude:
5 | # Ignore generated files
6 |
7 | linter:
8 | rules:
9 | prefer_single_quotes: true
10 | lines_longer_than_80_chars: true
11 |
12 |
13 |
14 |
15 | # Additional information about this file can be found at
16 | # https://dart.dev/guides/language/analysis-options
17 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.millicast_flutter_sdk'
2 | version '1.0'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | mavenCentral()
8 | jcenter()
9 | }
10 |
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:4.1.3'
13 | }
14 | }
15 |
16 | rootProject.allprojects {
17 | repositories {
18 | google()
19 | mavenCentral()
20 | jcenter()
21 | maven { url 'https://jitpack.io' }
22 | }
23 | }
24 |
25 | apply plugin: 'com.android.library'
26 |
27 | android {
28 | compileSdkVersion 33
29 |
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 |
35 | defaultConfig {
36 | minSdkVersion 21
37 | multiDexEnabled true
38 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
39 | consumerProguardFiles 'proguard-rules.pro'
40 | }
41 | }
42 |
43 | dependencies {
44 | implementation 'io.github.webrtc-sdk:android:104.5112.09'
45 | implementation 'androidx.annotation:annotation:1.1.0'
46 | implementation 'com.android.support:multidex:2.0.1'
47 | }
48 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | ## For more details on how to configure your build environment visit
2 | # http://www.gradle.org/docs/current/userguide/build_environment.html
3 | #
4 | # Specifies the JVM arguments used for the daemon process.
5 | # The setting is particularly useful for tweaking memory settings.
6 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
7 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
8 | #
9 | # When configured, Gradle will run in incubating parallel mode.
10 | # This option should only be used with decoupled projects. More details, visit
11 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
12 | # org.gradle.parallel=true
13 | #Mon May 02 10:37:31 UYT 2022
14 | org.gradle.jvmargs=-Xmx1536M
15 | android.useAndroidX=true
16 | android.enableJetifier=true
17 |
--------------------------------------------------------------------------------
/android/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Flutter WebRTC
2 | -keep class com.cloudwebrtc.webrtc.** { *; }
3 | -keep class org.webrtc.** { *; }
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'millicast_flutter_sdk'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/java/com/millicast_flutter_sdk/MillicastFlutterSdkPlugin.java:
--------------------------------------------------------------------------------
1 | package com.millicast_flutter_sdk;
2 |
3 | import androidx.annotation.NonNull;
4 |
5 | // import com.cloudwebrtc.webrtc.utils.EglUtils;
6 |
7 | import org.webrtc.DefaultVideoEncoderFactory;
8 | import org.webrtc.EglBase;
9 | import org.webrtc.VideoCodecInfo;
10 |
11 | import java.util.ArrayList;
12 | import java.util.Map;
13 |
14 | import io.flutter.embedding.engine.plugins.FlutterPlugin;
15 | import io.flutter.plugin.common.MethodCall;
16 | import io.flutter.plugin.common.MethodChannel;
17 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
18 | import io.flutter.plugin.common.MethodChannel.Result;
19 |
20 | /** MillicastFlutterSdkPlugin */
21 | public class MillicastFlutterSdkPlugin implements FlutterPlugin, MethodCallHandler {
22 | /// The MethodChannel that will the communication between Flutter and native Android
23 | ///
24 | /// This local reference serves to register the plugin with the Flutter Engine and unregister it
25 | /// when the Flutter Engine is detached from the Activity
26 | private MethodChannel channel;
27 |
28 | @Override
29 | public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
30 | channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "millicast_flutter_sdk");
31 | channel.setMethodCallHandler(this);
32 | }
33 |
34 | @Override
35 | public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
36 | switch (call.method) {
37 | case "getSupportedCodecs":
38 | EglBase eglBase = EglBase.createEgl10(EglBase.CONFIG_PLAIN);
39 | EglBase.Context eglContext = eglBase == null ? null : eglBase.getEglBaseContext();
40 | DefaultVideoEncoderFactory dummyEncoderFactory = new DefaultVideoEncoderFactory(
41 | eglContext, true, true);
42 | ArrayList codecs = new ArrayList();
43 | for (VideoCodecInfo codec : dummyEncoderFactory.getSupportedCodecs()) {
44 | codecs.add(codec.name);
45 | }
46 | result.success(codecs);
47 | break;
48 | case "getPlatformVersion":
49 | result.success("Android " + android.os.Build.VERSION.RELEASE);
50 | default:
51 | result.notImplemented();
52 | break;
53 | }
54 | }
55 |
56 | @Override
57 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
58 | channel.setMethodCallHandler(null);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/developer-info.md:
--------------------------------------------------------------------------------
1 | # Develop in Millicast Flutter SDK
2 |
3 | ## Development
4 |
5 | Follow the installation indicated [here](https://docs.flutter.dev/get-started/install).
6 | Assuming that you have succesfully run `flutter doctor`, that your flutter version is 2.10.x or newer and `dart` is installed, install the required dependencies running:
7 |
8 | ```sh
9 | $ flutter pub get
10 | ```
11 |
12 | > **Note for iOS**: Each time WebRTC dependency gets upgraded, dependency `WebRTC-SDK` has to be updated to the required version in the `ios/millicast_flutter_sdk.podspec` file.
13 | ### Running demo
14 |
15 | If you want to add, fix or edit features in SDK, or just try our demo, follow these steps:
16 | Before running it, you should add a `.env` file in the [example](example) folder. You can find the following example in `.env.sample`:
17 |
18 | ```sh
19 | # Make a .env file with the following vars
20 | MILLICAST_STREAM_NAME='my-stream-name'
21 | MILLICAST_ACCOUNT_ID='my-account-id'
22 | MILLICAST_PUBLISH_TOKEN='my-publish-token'
23 | ```
24 |
25 | In order to get these credentials, you must go to the [Millicast Website](https://www.millicast.com), login and in the dashboard create a new Stream Token. This Stream Token will have all the needed info to set in the `.env` file.
26 |
27 | You can now run our demo. Just select your desired device and then run:
28 |
29 | ```sh
30 | $ flutter run
31 | ```
32 |
33 | You will be prompted with two buttons in the app main page, you must select in the device whether you would like to publish or subscribe to a stream.
34 |
35 | ### Building docs
36 |
37 | The SDK documentation is written with [Dartdoc](https://pub.dev/packages/dartdoc), so to build documentation to get HTMLs files run:
38 |
39 | ```
40 | $ dart pub global activate dartdoc
41 | ```
42 |
43 | to install Dartdoc, and then run:
44 |
45 | ```sh
46 | $ dartdoc
47 | ```
48 |
49 | to build the actual documentation.
50 |
51 | If you want to navigate docs in your localhost run:
52 |
53 | ```sh
54 | $ pub global activate dhttpd
55 | $ dhttpd --path doc/api
56 | ```
57 |
58 | Navigate to `http://localhost:8080` in your browser; the search function should now work.
59 |
60 | ### Changing classes
61 |
62 | Whenever a class is changed, the mock generator should be executed to maintain the test suite working properly.
63 |
64 | To do that, in the terminal you should run:
65 |
66 | ```sh
67 | $ flutter pub run build_runner build
68 | ```
69 |
--------------------------------------------------------------------------------
/example/.env.sample:
--------------------------------------------------------------------------------
1 | MILLICAST_STREAM_NAME=yourStreamName
2 | MILLICAST_ACCOUNT_ID=yourAccountId
3 | MILLICAST_PUBLISH_TOKEN=yourPublishToken
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
--------------------------------------------------------------------------------
/example/.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: 135454af32477f815a7525073027a3ff9eff1bfd
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: 135454af32477f815a7525073027a3ff9eff1bfd
17 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
18 | - platform: macos
19 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
20 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
21 |
22 | # User provided section
23 |
24 | # List of Local paths (relative to this file) that should be
25 | # ignored by the migrate tool.
26 | #
27 | # Files that are not part of the templates will be ignored by default.
28 | unmanaged_files:
29 | - 'lib/main.dart'
30 | - 'ios/Runner.xcodeproj/project.pbxproj'
31 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # Example
2 |
3 | Millicast Flutter SDK Example
4 |
5 | ## Table of Contents
6 | * [Getting Started](#getting-started)
7 | * [Setup](#setup)
8 | + [Connect Real Device](#connect-real-device)
9 | - [Android](#android)
10 | - [iOS](#ios)
11 | + [Setting up Emulator with Android Studio](#setting-up-emulator-with-android-studio)
12 | - [Windows Emulator Installation Guide](#windows-emulator-installation-guide)
13 | - [MacOS Emulator Installation Guide](#macos-emulator-installation-guide)
14 | - [Linux Emulator Installation Guide](#linux-emulator-installation-guide)
15 | + [Setting Up Camera](#setting-up-camera)
16 | + [Setting Up Microphone](#setting-up-microphone)
17 | * [Setting up Emulator for iOS](#setting-up-emulator-for-ios)
18 | * [Usage](#usage)
19 | * [Publisher App](#publisher-app)
20 | + [Publisher Settings](#publisher-settings)
21 | * [Subscriber App](#subscriber-app)
22 | + [Subscriber Settings](#subscriber-settings)
23 |
24 | ## Getting Started
25 |
26 | This is used for End to End testing of every feature, before creating the pull request.
27 |
28 | ## Setup
29 |
30 | Follow the installation indicated [here](https://docs.flutter.dev/get-started/install).
31 | Assuming that you have successfully run `flutter doctor`, your flutter version is 2.10.x or newer and `dart` version above 2.16.x is installed, install the required dependencies running:
32 |
33 | ```sh
34 | $ flutter pub get
35 | ```
36 |
37 | Add a .env file in current path. You can find the following example in `.env.sample` file:
38 |
39 | ```
40 | MILLICAST_STREAM_NAME=yourStreamName
41 | MILLICAST_ACCOUNT_ID=yourAccountId
42 | MILLICAST_PUBLISH_TOKEN=yourPublishToken
43 | ```
44 |
45 | > You will need to find or create a new stream name with a token in your Millicast Dashboard. You can do that following this [link](https://docs.dolby.io/streaming-apis/docs/managing-your-tokens).
46 |
47 | You need to set up an emulator or connect a device in order to run the app.
48 |
49 | ### Connect Real Device
50 |
51 | #### Android:
52 |
53 | ```
54 | 1) Put you Android device in debug mode following this [tutorial](https://developer.android.com/studio/debug/dev-options).
55 | 2) Connect device and using your specific IDE,
56 | 3) Run flutter in the detected device.
57 | ```
58 |
59 | #### iOS:
60 |
61 | ```
62 | 1) Plug in your iPhone, sign in with your iCloud account in XCode.
63 | 2) Change the bundle identifier.
64 | 3) Change the device in your IDE.
65 | 4) Run flutter in the detected device.
66 | 5)[Optional] Open XCode => Runner => Build Settings => Enable bitcode => No
67 | ```
68 | #### Setting Up Emulator with Android Studio
69 |
70 | Following the guide indicated above, you should already have your emulator up and running.
71 |
72 | #### Windows Emulator Installation Guide
73 |
74 | For windows, follow this [link](https://docs.flutter.dev/get-started/install/windows#android-setup),
75 |
76 | #### MacOS Emulator Installation Guide
77 |
78 | For iOS, you can get more information on how to set up an emulator [here](https://docs.flutter.dev/get-started/install/macos).
79 |
80 | #### Linux Emulator Installation Guide
81 |
82 | You can get more information following this [link](https://docs.flutter.dev/get-started/install/linux).
83 |
84 |
85 | Be sure to give access to your computer camera and microphone in order to be able to use it for testing, otherwise the emulator will create a sample video simulating the camera usage.
86 |
87 | ### Setting Up Camera
88 |
89 | To give your Android emulator access to your camera, go to Android Studio and edit your desired emulator.
90 |
91 |
92 |
93 |
94 | ### Setting Up Microphone
95 |
96 | To give your Android emulator access to your microphone, start you emulator and open the emulator options. Then enable `Virtual headset plug inserted` and `Virtual microphone uses host audio input`.
97 |
98 |
99 |
100 | ## Setting up Emulator for iOS
101 |
102 | If you want to test the Publish feature in iOS you will need an actual Apple device, as the Apple emulator does not allow access to the camera.
103 |
104 | ## Usage
105 |
106 | To test the example app once the .env file is set up, simply run the following command in the `/example` folder:
107 |
108 | ```
109 | flutter run
110 | ```
111 |
112 | Once in the app you will be prompted with the home page allowing you to choose between the Publish and View options.
113 |
114 |
115 |
116 | ## Publisher App
117 |
118 | In the publisher app, you can switch camera, mute/unmute, turn off camera and share the stream with the `share` button.
119 |
120 | This app will also be subscribed to stream events, allowing you to keep the viewer user count.
121 |
122 |
123 |
124 | ### Publisher Settings
125 |
126 | Publisher settings allow you to set a SoruceId, set maximum bitrate, codec, simulcast and stereo.
127 |
128 | You may also change the stream information (name, accountId and publish token).
129 |
130 |
131 |
132 | ## Subscriber App
133 |
134 |
135 |
136 | ### Subscriber Settings
137 |
138 | Subscriber settings allow you to select a multisource SoruceId and different simulcast layers.
139 |
140 | You may also change the stream information (Stream name & accountId).
141 |
142 |
143 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | analyzer:
4 | exclude:
5 | # Ignore generated files
6 |
7 | linter:
8 | rules:
9 | prefer_single_quotes: true
10 |
11 |
12 | # Additional information about this file can be found at
13 | # https://dart.dev/guides/language/analysis-options
14 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 | /app/local.properties
9 |
10 | # Remember to never publicly share your keystore.
11 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
12 | key.properties
13 | **/*.keystore
14 | **/*.jks
15 |
--------------------------------------------------------------------------------
/example/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 FileNotFoundException("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 |
28 | android {
29 | compileSdkVersion 33
30 |
31 | compileOptions {
32 | sourceCompatibility JavaVersion.VERSION_1_8
33 | targetCompatibility JavaVersion.VERSION_1_8
34 | }
35 |
36 | kotlinOptions {
37 | jvmTarget = '1.8'
38 | }
39 |
40 | sourceSets {
41 | main.java.srcDirs += 'src/main/kotlin'
42 | }
43 |
44 | defaultConfig {
45 | applicationId "com.millicast.flutter.example"
46 | minSdkVersion 21
47 | targetSdkVersion flutter.targetSdkVersion
48 | versionCode flutterVersionCode.toInteger()
49 | versionName flutterVersionName
50 | }
51 |
52 | buildTypes {
53 | release {
54 | // TODO: Add your own signing config for the release build.
55 | // Signing with the debug keys for now, so `flutter run --release` works.
56 | signingConfig signingConfigs.debug
57 | }
58 | }
59 | }
60 |
61 | flutter {
62 | source '../..'
63 | }
64 |
65 | dependencies {
66 | implementation 'androidx.annotation:annotation:1.1.0'
67 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
68 | }
69 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
16 |
24 |
28 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
43 |
44 |
45 |
47 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/millicast/flutter/example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.millicast.flutter.example;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.annotation.Nullable;
5 |
6 | import android.content.ContextWrapper;
7 | import android.content.Intent;
8 | import android.content.IntentFilter;
9 |
10 | import io.flutter.embedding.android.FlutterActivity;
11 | import io.flutter.embedding.engine.FlutterEngine;
12 | import io.flutter.plugin.common.MethodChannel;
13 |
14 | public class MainActivity extends FlutterActivity {
15 | }
16 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-hdpi/launcher_icon.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-mdpi/launcher_icon.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.0'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.0.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
7 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/assets/HomeScreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/assets/HomeScreen.png
--------------------------------------------------------------------------------
/example/assets/PublisherHome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/assets/PublisherHome.png
--------------------------------------------------------------------------------
/example/assets/PublisherSettings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/assets/PublisherSettings.png
--------------------------------------------------------------------------------
/example/assets/SubscriberHome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/assets/SubscriberHome.png
--------------------------------------------------------------------------------
/example/assets/SubscriberSettings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/assets/SubscriberSettings.png
--------------------------------------------------------------------------------
/example/assets/millicastImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/assets/millicastImage.png
--------------------------------------------------------------------------------
/example/assets/setCameraAndroidStudio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/assets/setCameraAndroidStudio.png
--------------------------------------------------------------------------------
/example/assets/setMicAndroidEmulator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/assets/setMicAndroidEmulator.png
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 |
38 | post_install do |installer|
39 | installer.pods_project.targets.each do |target|
40 | flutter_additional_ios_build_settings(target)
41 | target.build_configurations.each do |config|
42 | config.build_settings['IPHONE_DEPLOYMENT_TARGET']='10.0'
43 | config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulators*]']='arm64'
44 | config.build_settings['ONLY_ACTIVE_ARCH']='YES'
45 | config.build_settings['ENABLE_BITCODE']='NO'
46 | end
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_webrtc (0.9.31):
4 | - Flutter
5 | - WebRTC-SDK (= 104.5112.17)
6 | - millicast_flutter_sdk (1.2.0):
7 | - Flutter
8 | - WebRTC-SDK (= 104.5112.17)
9 | - path_provider_foundation (0.0.1):
10 | - Flutter
11 | - FlutterMacOS
12 | - permission_handler_apple (9.1.1):
13 | - Flutter
14 | - share_plus (0.0.1):
15 | - Flutter
16 | - WebRTC-SDK (104.5112.17)
17 |
18 | DEPENDENCIES:
19 | - Flutter (from `Flutter`)
20 | - flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
21 | - millicast_flutter_sdk (from `.symlinks/plugins/millicast_flutter_sdk/ios`)
22 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
23 | - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
24 | - share_plus (from `.symlinks/plugins/share_plus/ios`)
25 |
26 | SPEC REPOS:
27 | trunk:
28 | - WebRTC-SDK
29 |
30 | EXTERNAL SOURCES:
31 | Flutter:
32 | :path: Flutter
33 | flutter_webrtc:
34 | :path: ".symlinks/plugins/flutter_webrtc/ios"
35 | millicast_flutter_sdk:
36 | :path: ".symlinks/plugins/millicast_flutter_sdk/ios"
37 | path_provider_foundation:
38 | :path: ".symlinks/plugins/path_provider_foundation/ios"
39 | permission_handler_apple:
40 | :path: ".symlinks/plugins/permission_handler_apple/ios"
41 | share_plus:
42 | :path: ".symlinks/plugins/share_plus/ios"
43 |
44 | SPEC CHECKSUMS:
45 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
46 | flutter_webrtc: 02c023207f972145a3bc8c7aada86754f264d563
47 | millicast_flutter_sdk: 7604de83ca2016742335a91f3b111a5620987a36
48 | path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
49 | permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
50 | share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
51 | WebRTC-SDK: 082ae4893212534a779ca233f19a9df8efd5f3bd
52 |
53 | PODFILE CHECKSUM: c7f777b8cab1ad7af915902f4105c73f4511ff5a
54 |
55 | COCOAPODS: 1.12.1
56 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/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.
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CADisableMinimumFrameDurationOnPhone
6 |
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | millicast_flutter_sdk
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | NSCameraUsageDescription
28 | $(PRODUCT_NAME) Camera Usage!
29 | NSMicrophoneUsageDescription
30 | $(PRODUCT_NAME) Microphone Usage!
31 | NSPhotoLibraryUsageDescription
32 | $(PRODUCT_NAME) PhotoLibrary Usage!
33 | UIBackgroundModes
34 |
35 | fetch
36 | remote-notification
37 |
38 | UILaunchStoryboardName
39 | LaunchScreen
40 | UIMainStoryboardFile
41 | Main
42 | UISupportedInterfaceOrientations
43 |
44 | UIInterfaceOrientationPortrait
45 | UIInterfaceOrientationLandscapeLeft
46 | UIInterfaceOrientationLandscapeRight
47 |
48 | UISupportedInterfaceOrientations~ipad
49 |
50 | UIInterfaceOrientationPortrait
51 | UIInterfaceOrientationPortraitUpsideDown
52 | UIInterfaceOrientationLandscapeLeft
53 | UIInterfaceOrientationLandscapeRight
54 |
55 | UIViewControllerBasedStatusBarAppearance
56 |
57 | com.apple.developer.associated-domains
58 |
59 | applinks:viewer.millicast.com
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/lib/home_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class HomeScreen extends StatelessWidget {
4 | final bool? isOpenedWithLink;
5 | const HomeScreen({
6 | Key? key,
7 | this.isOpenedWithLink,
8 | }) : super(key: key);
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | return Scaffold(
13 | appBar: AppBar(
14 | centerTitle: true,
15 | backgroundColor: Colors.white,
16 | // Here we take the value from the MyHomePage object that was created by
17 | // the App.build method, and use it to set our appbar title.
18 | title: Center(
19 | child: Row(
20 | crossAxisAlignment: CrossAxisAlignment.center,
21 | mainAxisSize: MainAxisSize.max,
22 | children: [
23 | Image.asset(
24 | 'assets/millicastImage.png',
25 | fit: BoxFit.contain,
26 | height: 40,
27 | ),
28 | Container(
29 | width: 5,
30 | ),
31 | const Text('Millicast SDK Demo',
32 | style: TextStyle(color: Colors.black, fontSize: 15))
33 | ])),
34 | ),
35 | body: Center(
36 | child: Row(
37 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
38 | children: [
39 | SizedBox(
40 | height: MediaQuery.of(context).size.height * 0.3,
41 | width: MediaQuery.of(context).size.width * 0.4,
42 | child: ElevatedButton(
43 | // Within the `FirstScreen` widget
44 | onPressed: () {
45 | // Navigate to the second screen using a named route.
46 | Navigator.pushReplacementNamed(context, '/publisher');
47 | },
48 | child: const Text(
49 | 'Publisher App',
50 | textAlign: TextAlign.center,
51 | style: TextStyle(color: Colors.white, fontSize: 25),
52 | ))),
53 | SizedBox(
54 | height: MediaQuery.of(context).size.height * 0.3,
55 | width: MediaQuery.of(context).size.width * 0.4,
56 | child: ElevatedButton(
57 | // Within the `FirstScreen` widget
58 | onPressed: () {
59 | // Navigate to the second screen using a named route.
60 | Navigator.pushReplacementNamed(context, '/subscriber');
61 | },
62 | child: const Text(
63 | 'Subscriber App',
64 | textAlign: TextAlign.center,
65 | style: TextStyle(color: Colors.white, fontSize: 25),
66 | ),
67 | )),
68 | ])),
69 | );
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_dotenv/flutter_dotenv.dart';
3 | import 'package:logger/logger.dart';
4 | import 'home_screen.dart';
5 | import 'publisher_widget.dart';
6 | import 'subscriber_widget.dart';
7 | import 'publisher_settings_widget.dart';
8 |
9 | void main() async {
10 | Logger.level = Level.info;
11 | await dotenv.load(fileName: '.env');
12 | runApp(const MyApp());
13 | }
14 |
15 | class MyApp extends StatelessWidget {
16 | const MyApp({Key? key}) : super(key: key);
17 |
18 | // This widget is the root of your application.
19 | @override
20 | Widget build(BuildContext context) {
21 | return MaterialApp(
22 | theme: ThemeData(
23 | primarySwatch: Colors.purple, secondaryHeaderColor: Colors.purple),
24 | initialRoute: '/',
25 | routes: {
26 | // When navigating to the "/" route, build the FirstScreen widget.
27 | // '/': (context) => const HomeScreen(),
28 | // When navigating to the "/second" route, build the SecondScreen widget.
29 | '/publisher': (context) => const PublisherWidget(),
30 | '/subscriber': (context) => const SubscriberWidget(),
31 | '/settings': (context) => const PublisherSettingsWidget(
32 | isConnected: false,
33 | supportedCodecs: [],
34 | )
35 | },
36 | home: const HomeScreen(),
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/example/lib/millicast_publisher_user_media.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter_webrtc/flutter_webrtc.dart';
4 | import 'package:millicast_flutter_sdk/millicast_flutter_sdk.dart';
5 | import 'package:flutter/foundation.dart';
6 |
7 | var _logger = getLogger('MillicastPublishUserMedia');
8 |
9 | const connectOptions = {
10 | 'bandwidth': 0,
11 | 'disableVideo': false,
12 | 'disableAudio': false,
13 | };
14 |
15 | const String sourceId = String.fromEnvironment('sourceId');
16 |
17 | class MillicastPublishUserMedia extends Publish {
18 | MillicastMedia? mediaManager;
19 | List? supportedCodecs;
20 |
21 | MillicastPublishUserMedia(options, tokenGenerator, autoReconnect)
22 | : super(
23 | streamName: options['streamName'],
24 | tokenGenerator: tokenGenerator,
25 | autoReconnect: autoReconnect) {
26 | mediaManager = MillicastMedia(options);
27 | }
28 |
29 | static build(options, tokenGenerator, autoReconnect) async {
30 | MillicastPublishUserMedia instance =
31 | MillicastPublishUserMedia(options, tokenGenerator, autoReconnect);
32 |
33 | await instance.getMediaStream();
34 | return instance;
35 | }
36 |
37 | getMediaStream() async {
38 | try {
39 | return await mediaManager?.getMedia();
40 | } catch (e) {
41 | rethrow;
42 | }
43 | }
44 |
45 | muteMedia(type, boo) {
46 | if (type == 'audio') {
47 | mediaManager?.muteAudio(boolean: boo);
48 | } else if (type == 'video') {
49 | mediaManager?.muteVideo(boolean: boo);
50 | }
51 | }
52 |
53 | migrate() {
54 | signaling?.emit('migrate');
55 | }
56 |
57 | @override
58 | connect({Map options = connectOptions}) async {
59 | if (mediaManager == null) {
60 | throw Exception('mediaManager not initialized correctly');
61 | }
62 | await super.connect(
63 | options: {...options, 'mediaStream': mediaManager?.mediaStream},
64 | );
65 | }
66 |
67 | hangUp(bool connected) async {
68 | if (connected) {
69 | _logger.w('Disconnecting');
70 | await stop();
71 | }
72 | return connected;
73 | }
74 |
75 | updateBandwidth(num bitrate) async {
76 | await webRTCPeer.updateBitrate(bitrate: bitrate);
77 | }
78 |
79 | close() async {
80 | await webRTCPeer.closeRTCPeer();
81 | }
82 | }
83 |
84 | class MillicastMedia {
85 | MediaStream? mediaStream;
86 | late Map constraints;
87 | MillicastMedia(Map? options) {
88 | constraints = {
89 | 'audio': {
90 | 'echoCancellation': true,
91 | 'channelCount': {'ideal': 2},
92 | },
93 | 'video': {
94 | 'height': 1080,
95 | 'width': 1920,
96 | },
97 | };
98 |
99 | if (options != null && options['constraints'] != null) {
100 | constraints.addAll(options['constraints']);
101 | }
102 | }
103 |
104 | getMedia() async {
105 | /// gets user cam and mic
106 |
107 | try {
108 | mediaStream = await navigator.mediaDevices.getUserMedia(constraints);
109 |
110 | // Adding this check check so we don't lose web support
111 | if (!kIsWeb) {
112 | if (Platform.isIOS) {
113 | mediaStream?.getAudioTracks()[0].enableSpeakerphone(true);
114 | }
115 | }
116 | return mediaStream;
117 | } catch (e) {
118 | throw Error();
119 | }
120 | }
121 |
122 | /// [boolean] - true if you want to mute the audio, false for mute it.
123 | /// Returns [bool] - returns true if it was changed, otherwise returns false.
124 | bool muteAudio({boolean = true}) {
125 | var changed = false;
126 | if (mediaStream != null) {
127 | mediaStream?.getAudioTracks()[0].enabled = !boolean;
128 | changed = true;
129 | } else {
130 | _logger.e('There is no media stream object.');
131 | }
132 | return changed;
133 | }
134 |
135 | bool switchCamera({boolean = true}) {
136 | var changed = false;
137 | if (mediaStream != null) {
138 | MediaStreamTrack? mediaStreamTrack = mediaStream?.getVideoTracks()[0];
139 | Helper.switchCamera(mediaStreamTrack!);
140 | changed = true;
141 | } else {
142 | _logger.e('There is no media stream object.');
143 | }
144 | return changed;
145 | }
146 |
147 | ///
148 | /// [bool] boolean - true if you want to mute the video, false for mute it.
149 | /// Returns [bool] - returns true if it was changed, otherwise returns false.
150 | ///
151 | bool muteVideo({boolean = true}) {
152 | var changed = false;
153 | if (mediaStream != null) {
154 | mediaStream?.getVideoTracks()[0].enabled = !boolean;
155 | changed = true;
156 | } else {
157 | _logger.e('There is no media stream object.');
158 | }
159 | return changed;
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/example/lib/publisher.dart:
--------------------------------------------------------------------------------
1 | import 'package:example/millicast_publisher_user_media.dart';
2 | import 'package:example/utils/constants.dart';
3 | import 'package:flutter_webrtc/flutter_webrtc.dart';
4 | import 'package:millicast_flutter_sdk/millicast_flutter_sdk.dart';
5 |
6 | Future buildPublisher(
7 | RTCVideoRenderer localRenderer) async {
8 | // Setting subscriber options
9 | DirectorPublisherOptions directorPublisherOptions = DirectorPublisherOptions(
10 | token: Constants.publishToken, streamName: Constants.streamName);
11 |
12 | /// Define callback for generate new token`
13 | tokenGenerator() => Director.getPublisher(directorPublisherOptions);
14 |
15 | /// Create a new instance
16 | MillicastPublishUserMedia publish = await MillicastPublishUserMedia.build(
17 | {'streamName': Constants.streamName}, tokenGenerator, true);
18 |
19 | localRenderer.srcObject = publish.mediaManager?.mediaStream;
20 | return publish;
21 | }
22 |
23 | Future connectPublisher(
24 | MillicastPublishUserMedia publish, Map mainOptions) async {
25 | /// Start connection to publisher
26 | try {
27 | Map options = {
28 | 'events': ['active', 'inactive', 'layers', 'viewercount']
29 | };
30 |
31 | options['codec'] = 'vp8';
32 |
33 | if (mainOptions.containsKey('sourceId')) {
34 | options['sourceId'] = mainOptions['sourceId'];
35 | }
36 | if (mainOptions.containsKey('stereo')) {
37 | options['stereo'] = mainOptions['stereo'];
38 | }
39 | if (mainOptions.containsKey('dtx')) {
40 | options['dtx'] = mainOptions['dtx'];
41 | }
42 | if (mainOptions.containsKey('absCaptureTime')) {
43 | options['absCaptureTime'] = mainOptions['absCaptureTime'];
44 | }
45 | if (mainOptions.containsKey('dependencyDescriptor')) {
46 | options['dependencyDescriptor'] = mainOptions['dependencyDescriptor'];
47 | }
48 | if (mainOptions.containsKey('simulcast')) {
49 | options['simulcast'] = mainOptions['simulcast'];
50 | }
51 | if (mainOptions.containsKey('codec')) {
52 | options['codec'] = mainOptions['codec'];
53 | }
54 | if (mainOptions.containsKey('bandwidth')) {
55 | options['bandwidth'] = mainOptions['bandwidth'];
56 | }
57 |
58 | await publish.connect(options: options);
59 | return publish;
60 | } catch (e) {
61 | throw Exception(e);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/example/lib/utils/constants.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_dotenv/flutter_dotenv.dart';
2 |
3 | class Constants {
4 | static String streamName =
5 | dotenv.env['MILLICAST_STREAM_NAME'] ?? 'testStramName';
6 | static String accountId =
7 | dotenv.env['MILLICAST_ACCOUNT_ID'] ?? 'testAccountId';
8 | static String publishToken =
9 | dotenv.env['MILLICAST_PUBLISH_TOKEN'] ?? 'testPublishToken';
10 |
11 | static Map topicRequest = {
12 | 'arguments': [
13 | ['$accountId/$streamName']
14 | ],
15 | 'invocationId': '0',
16 | 'streamIds': [],
17 | 'target': 'SubscribeViewerCount',
18 | 'type': 1
19 | };
20 |
21 | static const Map rtcPeerConf = {
22 | 'rtcpMuxPolicy': 'require',
23 | 'bundlePolicy': 'max-bundle'
24 | };
25 | static const Map offerSdpConstraints = {
26 | 'mandatory': {
27 | 'OfferToReceiveAudio': true,
28 | 'OfferToReceiveVideo': true,
29 | }
30 | };
31 |
32 | static void setConstants({String? newAccountId, String? newStreamName}) {
33 | accountId = newAccountId ?? accountId;
34 | streamName = newStreamName ?? streamName;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/example/lib/utils/token_response.dart:
--------------------------------------------------------------------------------
1 | class TokenResponse {
2 | bool subscribeRequiresAuth;
3 | String wsUrl;
4 | String jwt;
5 | String streamAccountId;
6 | List urls;
7 |
8 | TokenResponse(
9 | {required this.jwt,
10 | required this.streamAccountId,
11 | required this.wsUrl,
12 | required this.urls,
13 | required this.subscribeRequiresAuth});
14 |
15 | factory TokenResponse.fromJson(Map json) {
16 | return TokenResponse(
17 | jwt: json['jwt'] as String,
18 | streamAccountId: json['streamAccountId'] as String,
19 | wsUrl: json['wsUrl'] as String,
20 | subscribeRequiresAuth: (json['subscribeRequiresAuth'] ?? false) as bool,
21 | urls: json['urls'] as List);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/lib/viewer.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:example/utils/constants.dart';
4 | import 'package:flutter_webrtc/flutter_webrtc.dart';
5 | import 'package:millicast_flutter_sdk/millicast_flutter_sdk.dart';
6 |
7 | Set sourceIds = {};
8 | bool isMultisourceEnabled = false;
9 | bool isSimulcastEnabled = false;
10 | List currentLayers = [''];
11 |
12 | /// flag for live button
13 | bool isConnectedSubsc = false;
14 |
15 | int? oldLayersSize;
16 | int? currentLayerSize;
17 | // ignore: prefer_typing_uninitialized_variables
18 | var selectedVideoSource;
19 | // ignore: prefer_typing_uninitialized_variables
20 | var selectedAudioSource;
21 | var _logger = getLogger('ViewerDemo');
22 |
23 | Future buildSubscriber(RTCVideoRenderer localRenderer) async {
24 | // Setting subscriber options
25 | DirectorSubscriberOptions directorSubscriberOptions =
26 | DirectorSubscriberOptions(
27 | streamAccountId: Constants.accountId,
28 | streamName: Constants.streamName);
29 |
30 | /// Define callback for generate new token
31 | tokenGenerator() => Director.getSubscriber(directorSubscriberOptions);
32 |
33 | /// Create a new instance
34 | View view = View(
35 | streamName: Constants.streamName,
36 | tokenGenerator: tokenGenerator,
37 | mediaElement: localRenderer);
38 |
39 | view.on(webRTCEvents['track'], view, (ev, context) {
40 | RTCTrackEvent track = ev.eventData as RTCTrackEvent;
41 |
42 | if (track.streams.isNotEmpty) {
43 | localRenderer.srcObject = track.streams[0];
44 | }
45 | });
46 |
47 | // Based on broadcast events control different(multisource,simulcast) flows with flags and events in the ui
48 | view.on(SignalingEvents.broadcastEvent, view, (event, context) {
49 | String eventData = json.encode(event.eventData);
50 | Map eventDataMap = jsonDecode(eventData);
51 |
52 | switch (eventDataMap['name']) {
53 | // Case simulcast is enabled
54 | case 'layers':
55 | isSimulcastEnabled = true;
56 | currentLayerSize = eventDataMap['data']['medias']['0']['active'].length;
57 |
58 | if (currentLayerSize != oldLayersSize) {
59 | view.emit('layerChange', view);
60 | }
61 | if (currentLayerSize == 3) {
62 | currentLayers = ['Low', 'Medium', 'High', 'Auto'];
63 | } else if (currentLayerSize == 2) {
64 | currentLayers = ['Low', 'High', 'Auto'];
65 | } else {
66 | isSimulcastEnabled = false;
67 | }
68 | oldLayersSize = currentLayerSize;
69 |
70 | break;
71 |
72 | // Case you start publishing
73 | case 'active':
74 | isConnectedSubsc = true;
75 | // Case no multisource, sourceId will be Main
76 | if (eventDataMap['data']['sourceId'] == null) {
77 | isMultisourceEnabled = false;
78 | sourceIds.add('Main');
79 | view.emit('multisource', view, false);
80 | }
81 |
82 | // Case multisource is enabled sourceId!= null
83 | else {
84 | sourceIds.add(eventDataMap['data']['sourceId']);
85 | view.emit('multisource', view, true);
86 | isMultisourceEnabled = true;
87 | }
88 | break;
89 |
90 | // Case you stop publishing
91 | case 'inactive':
92 | if (eventDataMap['data']['sourceId'] != null) {
93 | // If the video you are subscribed to is stopped
94 | if (selectedVideoSource == eventDataMap['data']['sourceId']) {
95 | // Clean selected value from dropdown
96 | selectedVideoSource = null;
97 | }
98 |
99 | // If the audio you are subscribed to is stopped
100 | if (selectedAudioSource == eventDataMap['data']['sourceId']) {
101 | // Clean selected value from dropdown
102 | selectedAudioSource = null;
103 | }
104 |
105 | // Remove source from dropdownList
106 | if (eventDataMap['data']['sourceId'] != null) {
107 | sourceIds.remove(eventDataMap['data']['sourceId']);
108 | } else {
109 | sourceIds.remove('Main');
110 | }
111 | } else {
112 | isConnectedSubsc = false;
113 | }
114 |
115 | // No multisource
116 | if (sourceIds.isEmpty) {
117 | isMultisourceEnabled = false;
118 | view.emit('multisource', view, false);
119 | } else {
120 | view.emit('multisource', view, true);
121 | }
122 |
123 | isSimulcastEnabled = false;
124 | break;
125 |
126 | default:
127 | }
128 | });
129 | return view;
130 | }
131 |
132 | Future viewConnect(View view) async {
133 | /// Start connection to publisher
134 | try {
135 | await view.connect(options: {
136 | 'events': ['active', 'inactive', 'layers', 'viewercount'],
137 | });
138 |
139 | view.webRTCPeer.initStats();
140 |
141 | view.webRTCPeer.on('stats', view, (stats, context) {
142 | if (stats.eventData != null) {
143 | for (var report in stats.eventData as List) {
144 | if (report.type != 'codec') {
145 | _logger.d('${report.id}, ${report.type}, ${report.timestamp}');
146 | }
147 | }
148 | }
149 | });
150 | return view;
151 | } catch (e) {
152 | _logger.e(e);
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/example/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.10)
3 | project(runner LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "example")
8 | # The unique GTK application identifier for this application. See:
9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID
10 | set(APPLICATION_ID "com.millicast.flutter.example")
11 |
12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13 | # versions of CMake.
14 | cmake_policy(SET CMP0063 NEW)
15 |
16 | # Load bundled libraries from the lib/ directory relative to the binary.
17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
18 |
19 | # Root filesystem for cross-building.
20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT)
21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27 | endif()
28 |
29 | # Define build configuration options.
30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31 | set(CMAKE_BUILD_TYPE "Debug" CACHE
32 | STRING "Flutter build mode" FORCE)
33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
34 | "Debug" "Profile" "Release")
35 | endif()
36 |
37 | # Compilation settings that should be applied to most targets.
38 | #
39 | # Be cautious about adding new options here, as plugins use this function by
40 | # default. In most cases, you should add new options to specific targets instead
41 | # of modifying this function.
42 | function(APPLY_STANDARD_SETTINGS TARGET)
43 | target_compile_features(${TARGET} PUBLIC cxx_std_14)
44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror)
45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
47 | endfunction()
48 |
49 | # Flutter library and tool build rules.
50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
51 | add_subdirectory(${FLUTTER_MANAGED_DIR})
52 |
53 | # System-level dependencies.
54 | find_package(PkgConfig REQUIRED)
55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
56 |
57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58 |
59 | # Define the application target. To change its name, change BINARY_NAME above,
60 | # not the value here, or `flutter run` will no longer work.
61 | #
62 | # Any new source files that you add to the application should be added here.
63 | add_executable(${BINARY_NAME}
64 | "main.cc"
65 | "my_application.cc"
66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67 | )
68 |
69 | # Apply the standard set of build settings. This can be removed for applications
70 | # that need different build settings.
71 | apply_standard_settings(${BINARY_NAME})
72 |
73 | # Add dependency libraries. Add any application-specific dependencies here.
74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76 |
77 | # Run the Flutter tool portions of the build. This must not be removed.
78 | add_dependencies(${BINARY_NAME} flutter_assemble)
79 |
80 | # Only the install-generated bundle's copy of the executable will launch
81 | # correctly, since the resources must in the right relative locations. To avoid
82 | # people trying to run the unbundled copy, put it in a subdirectory instead of
83 | # the default top-level location.
84 | set_target_properties(${BINARY_NAME}
85 | PROPERTIES
86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87 | )
88 |
89 | # Generated plugin build rules, which manage building the plugins and adding
90 | # them to the application.
91 | include(flutter/generated_plugins.cmake)
92 |
93 |
94 | # === Installation ===
95 | # By default, "installing" just makes a relocatable bundle in the build
96 | # directory.
97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
100 | endif()
101 |
102 | # Start with a clean build bundle directory every time.
103 | install(CODE "
104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
105 | " COMPONENT Runtime)
106 |
107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
109 |
110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
111 | COMPONENT Runtime)
112 |
113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
114 | COMPONENT Runtime)
115 |
116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
117 | COMPONENT Runtime)
118 |
119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
120 | install(FILES "${bundled_library}"
121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
122 | COMPONENT Runtime)
123 | endforeach(bundled_library)
124 |
125 | # Fully re-copy the assets directory on each build to avoid having stale files
126 | # from a previous install.
127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
128 | install(CODE "
129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
130 | " COMPONENT Runtime)
131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
133 |
134 | # Install the AOT library on non-Debug builds only.
135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
137 | COMPONENT Runtime)
138 | endif()
139 |
--------------------------------------------------------------------------------
/example/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.10)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 |
12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
13 | # which isn't available in 3.10.
14 | function(list_prepend LIST_NAME PREFIX)
15 | set(NEW_LIST "")
16 | foreach(element ${${LIST_NAME}})
17 | list(APPEND NEW_LIST "${PREFIX}${element}")
18 | endforeach(element)
19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
20 | endfunction()
21 |
22 | # === Flutter Library ===
23 | # System-level dependencies.
24 | find_package(PkgConfig REQUIRED)
25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
28 |
29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30 |
31 | # Published to parent scope for install step.
32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36 |
37 | list(APPEND FLUTTER_LIBRARY_HEADERS
38 | "fl_basic_message_channel.h"
39 | "fl_binary_codec.h"
40 | "fl_binary_messenger.h"
41 | "fl_dart_project.h"
42 | "fl_engine.h"
43 | "fl_json_message_codec.h"
44 | "fl_json_method_codec.h"
45 | "fl_message_codec.h"
46 | "fl_method_call.h"
47 | "fl_method_channel.h"
48 | "fl_method_codec.h"
49 | "fl_method_response.h"
50 | "fl_plugin_registrar.h"
51 | "fl_plugin_registry.h"
52 | "fl_standard_message_codec.h"
53 | "fl_standard_method_codec.h"
54 | "fl_string_codec.h"
55 | "fl_value.h"
56 | "fl_view.h"
57 | "flutter_linux.h"
58 | )
59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60 | add_library(flutter INTERFACE)
61 | target_include_directories(flutter INTERFACE
62 | "${EPHEMERAL_DIR}"
63 | )
64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65 | target_link_libraries(flutter INTERFACE
66 | PkgConfig::GTK
67 | PkgConfig::GLIB
68 | PkgConfig::GIO
69 | )
70 | add_dependencies(flutter flutter_assemble)
71 |
72 | # === Flutter tool backend ===
73 | # _phony_ is a non-existent file to force this command to run every time,
74 | # since currently there's no way to get a full input/output list from the
75 | # flutter tool.
76 | add_custom_command(
77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
79 | COMMAND ${CMAKE_COMMAND} -E env
80 | ${FLUTTER_TOOL_ENVIRONMENT}
81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
83 | VERBATIM
84 | )
85 | add_custom_target(flutter_assemble DEPENDS
86 | "${FLUTTER_LIBRARY}"
87 | ${FLUTTER_LIBRARY_HEADERS}
88 | )
89 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | void fl_register_plugins(FlPluginRegistry* registry) {
14 | g_autoptr(FlPluginRegistrar) flutter_webrtc_registrar =
15 | fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterWebRTCPlugin");
16 | flutter_web_r_t_c_plugin_register_with_registrar(flutter_webrtc_registrar);
17 | g_autoptr(FlPluginRegistrar) millicast_flutter_sdk_registrar =
18 | fl_plugin_registry_get_registrar_for_plugin(registry, "MillicastFlutterSdkPlugin");
19 | millicast_flutter_sdk_plugin_register_with_registrar(millicast_flutter_sdk_registrar);
20 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
21 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
22 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
23 | }
24 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | flutter_webrtc
7 | millicast_flutter_sdk
8 | url_launcher_linux
9 | )
10 |
11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
12 | )
13 |
14 | set(PLUGIN_BUNDLED_LIBRARIES)
15 |
16 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
21 | endforeach(plugin)
22 |
23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
26 | endforeach(ffi_plugin)
27 |
--------------------------------------------------------------------------------
/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/example/linux/my_application.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | #include
4 | #ifdef GDK_WINDOWING_X11
5 | #include
6 | #endif
7 |
8 | #include "flutter/generated_plugin_registrant.h"
9 |
10 | struct _MyApplication {
11 | GtkApplication parent_instance;
12 | char** dart_entrypoint_arguments;
13 | };
14 |
15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
16 |
17 | // Implements GApplication::activate.
18 | static void my_application_activate(GApplication* application) {
19 | MyApplication* self = MY_APPLICATION(application);
20 | GtkWindow* window =
21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
22 |
23 | // Use a header bar when running in GNOME as this is the common style used
24 | // by applications and is the setup most users will be using (e.g. Ubuntu
25 | // desktop).
26 | // If running on X and not using GNOME then just use a traditional title bar
27 | // in case the window manager does more exotic layout, e.g. tiling.
28 | // If running on Wayland assume the header bar will work (may need changing
29 | // if future cases occur).
30 | gboolean use_header_bar = TRUE;
31 | #ifdef GDK_WINDOWING_X11
32 | GdkScreen* screen = gtk_window_get_screen(window);
33 | if (GDK_IS_X11_SCREEN(screen)) {
34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
36 | use_header_bar = FALSE;
37 | }
38 | }
39 | #endif
40 | if (use_header_bar) {
41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
42 | gtk_widget_show(GTK_WIDGET(header_bar));
43 | gtk_header_bar_set_title(header_bar, "example");
44 | gtk_header_bar_set_show_close_button(header_bar, TRUE);
45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46 | } else {
47 | gtk_window_set_title(window, "example");
48 | }
49 |
50 | gtk_window_set_default_size(window, 1280, 720);
51 | gtk_widget_show(GTK_WIDGET(window));
52 |
53 | g_autoptr(FlDartProject) project = fl_dart_project_new();
54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
55 |
56 | FlView* view = fl_view_new(project);
57 | gtk_widget_show(GTK_WIDGET(view));
58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
59 |
60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view));
61 |
62 | gtk_widget_grab_focus(GTK_WIDGET(view));
63 | }
64 |
65 | // Implements GApplication::local_command_line.
66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67 | MyApplication* self = MY_APPLICATION(application);
68 | // Strip out the first argument as it is the binary name.
69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
70 |
71 | g_autoptr(GError) error = nullptr;
72 | if (!g_application_register(application, nullptr, &error)) {
73 | g_warning("Failed to register: %s", error->message);
74 | *exit_status = 1;
75 | return TRUE;
76 | }
77 |
78 | g_application_activate(application);
79 | *exit_status = 0;
80 |
81 | return TRUE;
82 | }
83 |
84 | // Implements GObject::dispose.
85 | static void my_application_dispose(GObject* object) {
86 | MyApplication* self = MY_APPLICATION(object);
87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
89 | }
90 |
91 | static void my_application_class_init(MyApplicationClass* klass) {
92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95 | }
96 |
97 | static void my_application_init(MyApplication* self) {}
98 |
99 | MyApplication* my_application_new() {
100 | return MY_APPLICATION(g_object_new(my_application_get_type(),
101 | "application-id", APPLICATION_ID,
102 | "flags", G_APPLICATION_NON_UNIQUE,
103 | nullptr));
104 | }
105 |
--------------------------------------------------------------------------------
/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import flutter_webrtc
9 | import millicast_flutter_sdk
10 | import path_provider_foundation
11 | import share_plus
12 |
13 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
14 | FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
15 | MillicastFlutterSdkPlugin.register(with: registry.registrar(forPlugin: "MillicastFlutterSdkPlugin"))
16 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
17 | SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
18 | }
19 |
--------------------------------------------------------------------------------
/example/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.14'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 | use_modular_headers!
32 |
33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 | end
35 |
36 | post_install do |installer|
37 | installer.pods_project.targets.each do |target|
38 | flutter_additional_macos_build_settings(target)
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/example/macos/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - flutter_webrtc (0.9.31):
3 | - FlutterMacOS
4 | - WebRTC-SDK (= 104.5112.17)
5 | - FlutterMacOS (1.0.0)
6 | - millicast_flutter_sdk (0.0.1):
7 | - FlutterMacOS
8 | - path_provider_foundation (0.0.1):
9 | - Flutter
10 | - FlutterMacOS
11 | - share_plus (0.0.1):
12 | - FlutterMacOS
13 | - WebRTC-SDK (104.5112.17)
14 |
15 | DEPENDENCIES:
16 | - flutter_webrtc (from `Flutter/ephemeral/.symlinks/plugins/flutter_webrtc/macos`)
17 | - FlutterMacOS (from `Flutter/ephemeral`)
18 | - millicast_flutter_sdk (from `Flutter/ephemeral/.symlinks/plugins/millicast_flutter_sdk/macos`)
19 | - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`)
20 | - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
21 |
22 | SPEC REPOS:
23 | trunk:
24 | - WebRTC-SDK
25 |
26 | EXTERNAL SOURCES:
27 | flutter_webrtc:
28 | :path: Flutter/ephemeral/.symlinks/plugins/flutter_webrtc/macos
29 | FlutterMacOS:
30 | :path: Flutter/ephemeral
31 | millicast_flutter_sdk:
32 | :path: Flutter/ephemeral/.symlinks/plugins/millicast_flutter_sdk/macos
33 | path_provider_foundation:
34 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos
35 | share_plus:
36 | :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
37 |
38 | SPEC CHECKSUMS:
39 | flutter_webrtc: 9903b25f3648e335a40952058b14225e7b0df88d
40 | FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
41 | millicast_flutter_sdk: 9f92197cf94253e9400feb1cadccf0c33b2dd2cc
42 | path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
43 | share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7
44 | WebRTC-SDK: 082ae4893212534a779ca233f19a9df8efd5f3bd
45 |
46 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
47 |
48 | COCOAPODS: 1.12.1
49 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/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 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "mac",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "mac",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "mac",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "mac",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "mac",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "mac",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "mac",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "mac",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "mac",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "mac",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "mac",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "mac",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "mac",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "mac",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "mac",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "mac",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "mac",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "mac",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "mac",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.millicast.flutter.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.millicast.flutter. All rights reserved.
15 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 | com.apple.security.device.camera
12 |
13 | com.apple.security.device.audio-input
14 |
15 | com.apple.security.network.client
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | NSCameraUsageDescription
24 | $(PRODUCT_NAME) Camera Usage!
25 | NSMicrophoneUsageDescription
26 | $(PRODUCT_NAME) Microphone Usage!
27 | LSMinimumSystemVersion
28 | $(MACOSX_DEPLOYMENT_TARGET)
29 | NSHumanReadableCopyright
30 | $(PRODUCT_COPYRIGHT)
31 | NSMainNibFile
32 | MainMenu
33 | NSPrincipalClass
34 | NSApplication
35 |
36 |
37 |
--------------------------------------------------------------------------------
/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.network.server
8 |
9 | com.apple.security.device.camera
10 |
11 | com.apple.security.device.audio-input
12 |
13 | com.apple.security.network.client
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter project.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `flutter pub publish`. This is preferred for private packages.
6 | publish_to: "none" # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=2.15.1 <3.0.0"
22 |
23 | # Dependencies specify other packages that your package needs in order to work.
24 | # To automatically upgrade your package dependencies to the latest versions
25 | # consider running `flutter pub upgrade --major-versions`. Alternatively,
26 | # dependencies can be manually updated by changing the version numbers below to
27 | # the latest version available on pub.dev. To see which dependencies have newer
28 | # versions available, run `flutter pub outdated`.
29 | dependencies:
30 | flutter:
31 | sdk: flutter
32 | millicast_flutter_sdk:
33 | path: ../
34 |
35 | # The following adds the Cupertino Icons font to your application.
36 | # Use with the CupertinoIcons class for iOS style icons.
37 | cupertino_icons: ^1.0.5
38 | flutter_webrtc: ^0.9.19
39 | http: ^0.13.5
40 | web_socket_channel: ^2.3.0
41 | flutter_dotenv: ^5.0.2
42 | logger: ^1.1.0
43 | stop_watch_timer: ^2.0.0
44 | share_plus: ^6.3.0
45 | flutter_settings_ui: ^2.0.1
46 | permission_handler: ^10.2.0
47 | dev_dependencies:
48 | flutter_launcher_icons: ^0.11.0
49 | flutter_lints: ^2.0.1
50 | flutter_test:
51 | sdk: flutter
52 |
53 | flutter_icons:
54 | android: "launcher_icon"
55 | ios: true
56 | image_path: "assets/millicastImage.png"
57 |
58 | # The "flutter_lints" package below contains a set of recommended lints to
59 | # encourage good coding practices. The lint set provided by the package is
60 | # activated in the `analysis_options.yaml` file located at the root of your
61 | # package. See that file for information about deactivating specific lint
62 | # rules and activating additional ones.
63 | flutter_lints: ^1.0.0
64 |
65 | # For information on the generic Dart part of this file, see the
66 | # following page: https://dart.dev/tools/pub/pubspec
67 |
68 | # The following section is specific to Flutter.
69 | flutter:
70 | # The following line ensures that the Material Icons font is
71 | # included with your application, so that you can use the icons in
72 | # the material Icons class.
73 | uses-material-design: true
74 |
75 | # To add assets to your application, add an assets section, like this:
76 | assets:
77 | - assets/millicastImage.png
78 | # - images/a_dot_ham.jpeg
79 | - .env
80 | # An image asset can refer to one or more resolution-specific "variants", see
81 | # https://flutter.dev/assets-and-images/#resolution-aware.
82 |
83 | # For details regarding adding assets from package dependencies, see
84 | # https://flutter.dev/assets-and-images/#from-packages
85 |
86 | # To add custom fonts to your application, add a fonts section here,
87 | # in this "flutter" section. Each entry in this list should have a
88 | # "family" key with the font family name, and a "fonts" key with a
89 | # list giving the asset and other descriptors for the font. For
90 | # example:
91 | # fonts:
92 | # - family: Schyler
93 | # fonts:
94 | # - asset: fonts/Schyler-Regular.ttf
95 | # - asset: fonts/Schyler-Italic.ttf
96 | # style: italic
97 | # - family: Trajan Pro
98 | # fonts:
99 | # - asset: fonts/TrajanPro.ttf
100 | # - asset: fonts/TrajanPro_Bold.ttf
101 | # weight: 700
102 | #
103 | # For details regarding fonts from package dependencies,
104 | # see https://flutter.dev/custom-fonts/#from-packages
105 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(const MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/example/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.14)
3 | project(example LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "example")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(SET CMP0063 NEW)
12 |
13 | # Define build configuration option.
14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15 | if(IS_MULTICONFIG)
16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17 | CACHE STRING "" FORCE)
18 | else()
19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20 | set(CMAKE_BUILD_TYPE "Debug" CACHE
21 | STRING "Flutter build mode" FORCE)
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23 | "Debug" "Profile" "Release")
24 | endif()
25 | endif()
26 | # Define settings for the Profile build mode.
27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31 |
32 | # Use Unicode for all projects.
33 | add_definitions(-DUNICODE -D_UNICODE)
34 |
35 | # Compilation settings that should be applied to most targets.
36 | #
37 | # Be cautious about adding new options here, as plugins use this function by
38 | # default. In most cases, you should add new options to specific targets instead
39 | # of modifying this function.
40 | function(APPLY_STANDARD_SETTINGS TARGET)
41 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43 | target_compile_options(${TARGET} PRIVATE /EHsc)
44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
46 | endfunction()
47 |
48 | # Flutter library and tool build rules.
49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50 | add_subdirectory(${FLUTTER_MANAGED_DIR})
51 |
52 | # Application build; see runner/CMakeLists.txt.
53 | add_subdirectory("runner")
54 |
55 | # Generated plugin build rules, which manage building the plugins and adding
56 | # them to the application.
57 | include(flutter/generated_plugins.cmake)
58 |
59 |
60 | # === Installation ===
61 | # Support files are copied into place next to the executable, so that it can
62 | # run in place. This is done instead of making a separate bundle (as on Linux)
63 | # so that building and running from within Visual Studio will work.
64 | set(BUILD_BUNDLE_DIR "$")
65 | # Make the "install" step default, as it's required to run.
66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
69 | endif()
70 |
71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
73 |
74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
75 | COMPONENT Runtime)
76 |
77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
78 | COMPONENT Runtime)
79 |
80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
81 | COMPONENT Runtime)
82 |
83 | if(PLUGIN_BUNDLED_LIBRARIES)
84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
86 | COMPONENT Runtime)
87 | endif()
88 |
89 | # Fully re-copy the assets directory on each build to avoid having stale files
90 | # from a previous install.
91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
92 | install(CODE "
93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
94 | " COMPONENT Runtime)
95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
97 |
98 | # Install the AOT library on non-Debug builds only.
99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
100 | CONFIGURATIONS Profile;Release
101 | COMPONENT Runtime)
102 |
--------------------------------------------------------------------------------
/example/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.14)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
12 |
13 | # === Flutter Library ===
14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
15 |
16 | # Published to parent scope for install step.
17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
21 |
22 | list(APPEND FLUTTER_LIBRARY_HEADERS
23 | "flutter_export.h"
24 | "flutter_windows.h"
25 | "flutter_messenger.h"
26 | "flutter_plugin_registrar.h"
27 | "flutter_texture_registrar.h"
28 | )
29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
30 | add_library(flutter INTERFACE)
31 | target_include_directories(flutter INTERFACE
32 | "${EPHEMERAL_DIR}"
33 | )
34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
35 | add_dependencies(flutter flutter_assemble)
36 |
37 | # === Wrapper ===
38 | list(APPEND CPP_WRAPPER_SOURCES_CORE
39 | "core_implementations.cc"
40 | "standard_codec.cc"
41 | )
42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
44 | "plugin_registrar.cc"
45 | )
46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
47 | list(APPEND CPP_WRAPPER_SOURCES_APP
48 | "flutter_engine.cc"
49 | "flutter_view_controller.cc"
50 | )
51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
52 |
53 | # Wrapper sources needed for a plugin.
54 | add_library(flutter_wrapper_plugin STATIC
55 | ${CPP_WRAPPER_SOURCES_CORE}
56 | ${CPP_WRAPPER_SOURCES_PLUGIN}
57 | )
58 | apply_standard_settings(flutter_wrapper_plugin)
59 | set_target_properties(flutter_wrapper_plugin PROPERTIES
60 | POSITION_INDEPENDENT_CODE ON)
61 | set_target_properties(flutter_wrapper_plugin PROPERTIES
62 | CXX_VISIBILITY_PRESET hidden)
63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
64 | target_include_directories(flutter_wrapper_plugin PUBLIC
65 | "${WRAPPER_ROOT}/include"
66 | )
67 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
68 |
69 | # Wrapper sources needed for the runner.
70 | add_library(flutter_wrapper_app STATIC
71 | ${CPP_WRAPPER_SOURCES_CORE}
72 | ${CPP_WRAPPER_SOURCES_APP}
73 | )
74 | apply_standard_settings(flutter_wrapper_app)
75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
76 | target_include_directories(flutter_wrapper_app PUBLIC
77 | "${WRAPPER_ROOT}/include"
78 | )
79 | add_dependencies(flutter_wrapper_app flutter_assemble)
80 |
81 | # === Flutter tool backend ===
82 | # _phony_ is a non-existent file to force this command to run every time,
83 | # since currently there's no way to get a full input/output list from the
84 | # flutter tool.
85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
87 | add_custom_command(
88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
90 | ${CPP_WRAPPER_SOURCES_APP}
91 | ${PHONY_OUTPUT}
92 | COMMAND ${CMAKE_COMMAND} -E env
93 | ${FLUTTER_TOOL_ENVIRONMENT}
94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95 | windows-x64 $
96 | VERBATIM
97 | )
98 | add_custom_target(flutter_assemble DEPENDS
99 | "${FLUTTER_LIBRARY}"
100 | ${FLUTTER_LIBRARY_HEADERS}
101 | ${CPP_WRAPPER_SOURCES_CORE}
102 | ${CPP_WRAPPER_SOURCES_PLUGIN}
103 | ${CPP_WRAPPER_SOURCES_APP}
104 | )
105 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | void RegisterPlugins(flutter::PluginRegistry* registry) {
16 | FlutterWebRTCPluginRegisterWithRegistrar(
17 | registry->GetRegistrarForPlugin("FlutterWebRTCPlugin"));
18 | MillicastFlutterSdkPluginCApiRegisterWithRegistrar(
19 | registry->GetRegistrarForPlugin("MillicastFlutterSdkPluginCApi"));
20 | PermissionHandlerWindowsPluginRegisterWithRegistrar(
21 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
22 | SharePlusWindowsPluginCApiRegisterWithRegistrar(
23 | registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
24 | UrlLauncherWindowsRegisterWithRegistrar(
25 | registry->GetRegistrarForPlugin("UrlLauncherWindows"));
26 | }
27 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | flutter_webrtc
7 | millicast_flutter_sdk
8 | permission_handler_windows
9 | share_plus
10 | url_launcher_windows
11 | )
12 |
13 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
14 | )
15 |
16 | set(PLUGIN_BUNDLED_LIBRARIES)
17 |
18 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
19 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
20 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
21 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
23 | endforeach(plugin)
24 |
25 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
26 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
27 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
28 | endforeach(ffi_plugin)
29 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Add preprocessor definitions for the build version.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29 |
30 | # Disable Windows macros that collide with C++ standard library functions.
31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32 |
33 | # Add dependency libraries and include directories. Add any application-specific
34 | # dependencies here.
35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
37 |
38 | # Run the Flutter tool portions of the build. This must not be removed.
39 | add_dependencies(${BINARY_NAME} flutter_assemble)
40 |
--------------------------------------------------------------------------------
/example/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0,0
67 | #endif
68 |
69 | #if defined(FLUTTER_VERSION)
70 | #define VERSION_AS_STRING FLUTTER_VERSION
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "com.millicast.flutter" "\0"
93 | VALUE "FileDescription", "example" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "example" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.millicast.flutter. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "example.exe" "\0"
98 | VALUE "ProductName", "example" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 | return true;
30 | }
31 |
32 | void FlutterWindow::OnDestroy() {
33 | if (flutter_controller_) {
34 | flutter_controller_ = nullptr;
35 | }
36 |
37 | Win32Window::OnDestroy();
38 | }
39 |
40 | LRESULT
41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
42 | WPARAM const wparam,
43 | LPARAM const lparam) noexcept {
44 | // Give Flutter, including plugins, an opportunity to handle window messages.
45 | if (flutter_controller_) {
46 | std::optional result =
47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
48 | lparam);
49 | if (result) {
50 | return *result;
51 | }
52 | }
53 |
54 | switch (message) {
55 | case WM_FONTCHANGE:
56 | flutter_controller_->engine()->ReloadSystemFonts();
57 | break;
58 | }
59 |
60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
61 | }
62 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.CreateAndShow(L"example", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | std::string utf8_string;
52 | if (target_length == 0 || target_length > utf8_string.max_size()) {
53 | return utf8_string;
54 | }
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/example/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/Generated.xcconfig
37 | /Flutter/ephemeral/
38 | /Flutter/flutter_export_environment.sh
--------------------------------------------------------------------------------
/ios/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/millicast/flutter-sdk/ea1b3855241b38b436841f5ffb057d4c5ca1c59f/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/MillicastFlutterSdkPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface MillicastFlutterSdkPlugin : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/ios/Classes/MillicastFlutterSdkPlugin.m:
--------------------------------------------------------------------------------
1 | #import "MillicastFlutterSdkPlugin.h"
2 | #if __has_include()
3 | #import
4 | #else
5 | // Support project import fallback if the generated compatibility header
6 | // is not copied when this plugin is created as a library.
7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
8 | #import "millicast_flutter_sdk-Swift.h"
9 | #endif
10 |
11 | @implementation MillicastFlutterSdkPlugin
12 | + (void)registerWithRegistrar:(NSObject*)registrar {
13 | [SwiftMillicastFlutterSdkPlugin registerWithRegistrar:registrar];
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/ios/Classes/SwiftMillicastFlutterSdkPlugin.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 |
4 | public class SwiftMillicastFlutterSdkPlugin: NSObject, FlutterPlugin {
5 | public static func register(with registrar: FlutterPluginRegistrar) {
6 | let channel = FlutterMethodChannel(name: "millicast_flutter_sdk", binaryMessenger: registrar.messenger())
7 | let instance = SwiftMillicastFlutterSdkPlugin()
8 | registrar.addMethodCallDelegate(instance, channel: channel)
9 | }
10 |
11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
12 | result("iOS " + UIDevice.current.systemVersion)
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ios/millicast_flutter_sdk.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint millicast_flutter_sdk.podspec` to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'millicast_flutter_sdk'
7 | s.version = '1.2.0'
8 | s.summary = 'A Flutter SDK that allows developers to simplify Millicast services integration into their own Android and iOS apps.'
9 | s.homepage = 'https://github.com/millicast/flutter-sdk/ios'
10 | s.license = { :file => '../LICENSE' }
11 | s.author = { 'Millicast' => 'fabian.cancela@dolby.com' }
12 | s.source = { :path => '.' }
13 | s.source_files = 'Classes/**/*'
14 | s.dependency 'Flutter'
15 | s.dependency 'WebRTC-SDK', '104.5112.17'
16 | s.platform = :ios, '11.0'
17 |
18 | # Flutter.framework does not contain a i386 slice.
19 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
20 | s.swift_version = '5.0'
21 | end
22 |
--------------------------------------------------------------------------------
/lib/millicast_flutter_sdk.dart:
--------------------------------------------------------------------------------
1 | export 'src/director.dart';
2 | export 'src/publish.dart';
3 | export 'src/view.dart';
4 | export 'src/signaling.dart';
5 | export 'src/peer_connection.dart';
6 | export 'src/logger.dart';
7 | export 'src/utils/channel.dart';
8 |
--------------------------------------------------------------------------------
/lib/src/config.dart:
--------------------------------------------------------------------------------
1 | class Config {
2 | static const String millicastDirectorEndpoint =
3 | 'https://director.millicast.com';
4 | static const String millicastTurnserverLocation =
5 | 'https://turn.millicast.com/webrtc/_turn';
6 | static const String millicastEventsLocation =
7 | 'wss://streamevents.millicast.com/ws';
8 | static const String millicastFixedAccountId = '';
9 | }
10 |
--------------------------------------------------------------------------------
/lib/src/logger.dart:
--------------------------------------------------------------------------------
1 | import 'package:logger/logger.dart';
2 |
3 | Logger getLogger(String className) {
4 | var output = MultiOutput([memory, ConsoleOutput()]);
5 | return Logger(output: output, printer: InternalLogPrinter(className));
6 | }
7 |
8 | BufferMemoryOutput memory = BufferMemoryOutput(bufferSize: maxLogHistorySize);
9 | const defaultLogHistorySize = 10000;
10 | int maxLogHistorySize = defaultLogHistorySize;
11 | List history = [];
12 |
13 | /// LogPrinter implementation
14 | /// Log format '[className] Date - {Log.level} - {log.message}'
15 | class InternalLogPrinter extends LogPrinter {
16 | final String className;
17 | InternalLogPrinter(this.className);
18 |
19 | @override
20 | List log(LogEvent event) {
21 | AnsiColor? color = PrettyPrinter.levelColors[event.level];
22 | var logResult = color!(
23 | // ignore: lines_longer_than_80_chars
24 | '[$className] ${DateTime.now()} - ${(event.level).toString().toUpperCase().split('.')[1]} - ${event.message}');
25 | OutputEvent output = OutputEvent(event, [logResult]);
26 | memory.output(output);
27 | return [logResult];
28 | }
29 | }
30 |
31 | class BufferMemoryOutput extends MemoryOutput {
32 | @override
33 | // ignore: overridden_fields
34 | int bufferSize;
35 | // ignore: lines_longer_than_80_chars
36 | BufferMemoryOutput({required this.bufferSize, LogOutput? secondOutput})
37 | : super(bufferSize: bufferSize, secondOutput: secondOutput);
38 |
39 | void setBufferSize(int val) {
40 | bufferSize = val;
41 | if (buffer.length > bufferSize) {
42 | while (buffer.length > bufferSize) {
43 | buffer.removeFirst();
44 | }
45 | }
46 | }
47 |
48 | List getBuffer() {
49 | history = [];
50 | for (var element in memory.buffer) {
51 | {
52 | history.add(element.lines.first.toString());
53 | }
54 | }
55 | return history;
56 | }
57 |
58 | int getBufferMaxSize() {
59 | return bufferSize;
60 | }
61 |
62 | @override
63 | void output(OutputEvent event) {
64 | if (buffer.length >= bufferSize) {
65 | while (buffer.length >= bufferSize) {
66 | buffer.removeFirst();
67 | }
68 | }
69 | buffer.addAll([event]);
70 | secondOutput?.output(event);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/src/utils/base_web_rtc.dart:
--------------------------------------------------------------------------------
1 | import 'package:eventify/eventify.dart';
2 | import 'package:flutter_webrtc/flutter_webrtc.dart';
3 | import 'package:logger/logger.dart';
4 | import 'package:millicast_flutter_sdk/millicast_flutter_sdk.dart';
5 | import 'dart:async';
6 |
7 | const int maxReconnectionInterval = 32000;
8 | const int baseInterval = 1000;
9 |
10 | const Map connectOptions = {
11 | 'disableVideo': false,
12 | 'disableAudio': false,
13 | 'peerConfig': null
14 | };
15 |
16 | class BaseWebRTC extends EventEmitter {
17 | /// [streamName] - Millicast existing stream name.
18 | String streamName;
19 |
20 | /// [tokenGenerator] - Callback function executed when a new token is needed.
21 | Function tokenGenerator;
22 |
23 | /// [autoReconnect] - Enable auto reconnect.
24 | bool autoReconnect;
25 |
26 | /// [logger] - Logger instance from the extended classes.
27 | Logger logger;
28 | late Signaling? signaling;
29 | PeerConnection webRTCPeer = PeerConnection();
30 | int? reconnectionInterval;
31 | bool? alreadyDisconnected;
32 | bool? firstReconnection;
33 | bool stopReconnection = false;
34 | bool isReconnecting = false;
35 | Map? options;
36 |
37 | BaseWebRTC({
38 | required this.streamName,
39 | required this.tokenGenerator,
40 | required this.autoReconnect,
41 | required this.logger,
42 | this.signaling,
43 | this.reconnectionInterval = baseInterval,
44 | this.alreadyDisconnected = false,
45 | this.firstReconnection = true,
46 | this.options,
47 | });
48 |
49 | /// Get current RTC peer connection.
50 | ///
51 | /// Returns the [RTCPeerConnection].
52 | Future getRTCPeerConnection() async {
53 | return await webRTCPeer.getRTCPeer();
54 | }
55 |
56 | /// Stops connection.
57 | stop() {
58 | logger.i('Stopping');
59 | webRTCPeer.closeRTCPeer();
60 | signaling?.close();
61 | signaling = null;
62 | webRTCPeer = PeerConnection();
63 | }
64 |
65 | /// Get if the current connection is active.
66 | ///
67 | /// Returns true if connected, false if not.
68 | bool isActive() {
69 | String? rtcPeerState = webRTCPeer.getRTCPeerStatus();
70 | logger.i('Broadcast status: ${rtcPeerState.toString()}||not_established ');
71 | return (rtcPeerState == 'connected');
72 | }
73 |
74 | // This method should be overrided by publish or view
75 | connect({Map options = const {}}) async {}
76 |
77 | // This method should be overrided by publish or view
78 | replaceConnection() async {}
79 |
80 | /// Sets reconnection if autoReconnect is enabled.
81 | setReconnect() {
82 | signaling?.on('migrate', this, (ev, context) async {
83 | signaling?.isMigrating = true;
84 | await replaceConnection();
85 | signaling?.isMigrating = false;
86 | });
87 | if (autoReconnect) {
88 | signaling?.on(SignalingEvents.connectionError, this, (event, context) {
89 | if ((firstReconnection == null || alreadyDisconnected == false)) {
90 | firstReconnection = false;
91 | reconnect();
92 | }
93 | });
94 |
95 | webRTCPeer.on(webRTCEvents['connectionStateChange'], this,
96 | (event, context) {
97 | var state = event.eventData;
98 | if ((state == 'failed' ||
99 | (state == 'disconnected' && alreadyDisconnected!)) &&
100 | firstReconnection!) {
101 | firstReconnection = false;
102 | reconnect();
103 | } else if (state == 'disconnected') {
104 | alreadyDisconnected = true;
105 | Timer(const Duration(milliseconds: 1500), () => reconnect());
106 | } else {
107 | alreadyDisconnected = false;
108 | }
109 | });
110 | }
111 | }
112 |
113 | /// Reconnects to last broadcast.
114 | ///
115 | reconnect() async {
116 | try {
117 | if (stopReconnection) {
118 | return;
119 | }
120 |
121 | logger.i('Attempting to reconnect...');
122 | if (!isActive() && !isReconnecting) {
123 | stop();
124 | isReconnecting = true;
125 | if (options != null) {
126 | await connect(options: options!);
127 | } else {
128 | await connect();
129 | }
130 | alreadyDisconnected = false;
131 | reconnectionInterval = baseInterval;
132 | firstReconnection = true;
133 | isReconnecting = false;
134 | }
135 | } catch (error) {
136 | isReconnecting = false;
137 | reconnectionInterval = nextReconnectInterval(reconnectionInterval!);
138 | logger.e(
139 | '''Reconnection failed, retrying in ${reconnectionInterval}ms. Error was: $error''');
140 |
141 | /// Emits with every reconnection attempt made when an active stream
142 | /// stopped unexpectedly.
143 | ///
144 | /// [timeout] - Next retry interval in milliseconds.
145 | /// [error] - Error object with cause of failure.
146 | emit(
147 | 'reconnect', this, {'timeout': reconnectionInterval, 'error': error});
148 | Timer(Duration(milliseconds: reconnectionInterval!), () => reconnect());
149 | }
150 | }
151 | }
152 |
153 | int nextReconnectInterval(int interval) {
154 | return interval < maxReconnectionInterval ? interval * 2 : interval;
155 | }
156 |
157 | set stopReconnection(bool value) {
158 | stopReconnection = value;
159 | }
160 |
--------------------------------------------------------------------------------
/lib/src/utils/channel.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 |
4 | import 'package:flutter/foundation.dart';
5 | import 'package:flutter/services.dart';
6 |
7 | class NativeChannel {
8 | static const MethodChannel _channel = MethodChannel('millicast_flutter_sdk');
9 |
10 | static Future get platformVersion async {
11 | final String? version = await _channel.invokeMethod('getPlatformVersion');
12 | return version;
13 | }
14 |
15 | static Future> get supportedCodecs async {
16 | List codecs = [
17 | 'vp8',
18 | 'vp9',
19 | 'h264',
20 | 'av1',
21 | ];
22 | if (!kIsWeb) {
23 | if (Platform.isAndroid) {
24 | List