Millicast Flutter SDK Example
This is used for End to End testing of every feature, before creating the pull request.
Follow the installation indicated here.
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:
$ flutter pub get
Add a .env file in current path. You can find the following example in .env.sample
file:
MILLICAST_STREAM_NAME=yourStreamName
MILLICAST_ACCOUNT_ID=yourAccountId
MILLICAST_PUBLISH_TOKEN=yourPublishToken
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.
You need to set up an emulator or connect a device in order to run the app.
1) Put you Android device in debug mode following this [tutorial](https://developer.android.com/studio/debug/dev-options).
2) Connect device and using your specific IDE,
3) Run flutter in the detected device.
1) Plug in your iPhone, sign in with your iCloud account in XCode.
2) Change the bundle identifier.
3) Change the device in your IDE.
4) Run flutter in the detected device.
5)[Optional] Open XCode => Runner => Build Settings => Enable bitcode => No
Following the guide indicated above, you should already have your emulator up and running.
For windows, follow this link,
For iOS, you can get more information on how to set up an emulator here.
You can get more information following this link.
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.
To give your Android emulator access to your camera, go to Android Studio and edit your desired emulator.
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
.
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.
To test the example app once the .env file is set up, simply run the following command in the /example
folder:
flutter run
Once in the app you will be prompted with the home page allowing you to choose between the Publish and View options.
In the publisher app, you can switch camera, mute/unmute, turn off camera and share the stream with the share
button.
This app will also be subscribed to stream events, allowing you to keep the viewer user count.
Publisher settings allow you to set a SoruceId, set maximum bitrate, codec, simulcast and stereo.
You may also change the stream information (name, accountId and publish token).
Subscriber settings allow you to select a multisource SoruceId and different simulcast layers.
You may also change the stream information (Stream name & accountId).