Skip to content

Commit

Permalink
Merge pull request #611 from 100mslive/develop
Browse files Browse the repository at this point in the history
Release 0.7.2: Develop to main
  • Loading branch information
ygit authored Jun 2, 2022
2 parents 37a36b9 + beef450 commit 5df13ee
Show file tree
Hide file tree
Showing 112 changed files with 2,386 additions and 1,304 deletions.
1 change: 1 addition & 0 deletions .pubignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ example/android/app/google-services.json
example/ios/Runner/GoogleService-Info.plist
*.p8
release-apps.sh
example/lib/firebase_options.dart
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 0.7.2 - 2022-06-02

- Segregated RTC Stats update notifications from `HMSUpdateListener` into `HMSStatsListener`
- Removed `room_peer_count_updated` from `HMSRoomUpdate` enum
- Added `sessionId` to the `HMSRoom` class
- Updated to Native Android SDK 2.3.9 & Native iOS SDK 0.3.1

## 0.7.1 - 2022-05-20

- Added RTC Stats Listener which provides info about local & remote peer's audio/video quality
- Improved video rendering performance for Android devices
- Correct RTMP Streaming & Recording configuration settings
- Added support for Server-side Subscribe Degradation
- Updated to Native Android SDK 2.3.9 & Native iOS SDK 0.2.13

## 0.7.0 - 2022-04-19

### Added
Expand Down
98 changes: 52 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<a href="https://100ms.live/">
<img src="https://github.com/100mslive/100ms-flutter/blob/develop/100ms.gif" height=256/>
<img src="https://github.com/100mslive/100ms-flutter/blob/develop/100ms.gif" height=256/>
<img src="https://github.com/100mslive/100ms-flutter/blob/develop/100ms.svg" title="100ms logo" float=center height=256>
</a>

Expand All @@ -16,34 +16,36 @@

Here you will find everything you need to build experiences with video using 100ms iOS/Android SDK. Dive into our SDKs, quick starts, add real-time video, voice, and screen sharing to your web and mobile applications.

📲 Download the Sample iOS app here: https://testflight.apple.com/join/Uhzebmut
📲 Download the Sample iOS app here: <https://testflight.apple.com/join/Uhzebmut>

🤖 Download the Sample Android app here: https://appdistribution.firebase.dev/i/b623e5310929ab70
🤖 Download the Sample Android app here: <https://appdistribution.firebase.dev/i/b623e5310929ab70>

## 🏃‍♀️ How to run the Sample App

The Example app can be found [here](https://github.com/100mslive/100ms-flutter/tree/main/example).

1. In project root, run `flutter pub get`
2. Change directory to `example` folder & run either `flutter build ios` OR `flutter build apk`
3. Finally, `flutter run`

## 🚂 Setup Guide

1. Sign up on https://dashboard.100ms.live/register & visit the Developer tab to access your credentials.
1. Sign up on <https://dashboard.100ms.live/register> & visit the Developer tab to access your credentials.

2. Get familiarized with [Tokens & Security here](https://docs.100ms.live/flutter/foundation/security-and-tokens)

3. Complete the steps in [Auth Token Quick Start Guide](https://docs.100ms.live/flutter/guides/token)

4. Get the HMSSDK via [pub.dev](https://pub.dev/packages/hmssdk_flutter). Add the `hmssdk_flutter` to your pubspec.yaml
4. Get the HMSSDK via [pub.dev](https://pub.dev/packages/hmssdk_flutter). Add the `hmssdk_flutter` to your pubspec.yaml.

If you are running Flutter 3.0 or higher, use this branch to add the package: `flutter3.0`
<https://github.com/100mslive/100ms-flutter/tree/flutter3.0>

## 🏃‍♀️ How to run the Sample App

The Example app can be found [here](https://github.com/100mslive/100ms-flutter/tree/main/example).

1. In project root, run `flutter pub get`
2. Change directory to `example` folder & run either `flutter build ios` OR `flutter build apk`
3. Finally, `flutter run`

## ☝️ Pre-requisites

- Support for Android API level 24 or higher
- Support for Java 8
- Support for iOS 10 or higher
- Support for iOS 12 or higher
- Xcode 12 or higher

## 📱 Supported Devices
Expand All @@ -54,7 +56,7 @@ iPhone & iPads with iOS version 10 or higher.

## Android Permissions

Add following permissions in Android AndroidManifest.xml file
Add the following permissions in the Android AndroidManifest.xml file

```xml
<uses-feature android:name="android.hardware.camera"/>
Expand All @@ -78,10 +80,10 @@ Add following permissions in Android AndroidManifest.xml file
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
```


## iOS Permissions

Add following permissions in iOS Info.plist file

```xml
<key>NSMicrophoneUsageDescription</key>
<string>{YourAppName} wants to use your microphone</string>
Expand All @@ -93,14 +95,12 @@ Add following permissions in iOS Info.plist file
<string>{YourAppName} App wants to use your local network</string>
```


## 🧐 Key Concepts

- `Room` - A room represents real-time audio, video session, the basic building block of the 100mslive Video SDK
- `Track` - A track represents either the audio or video that makes up a stream
- `Peer` - A peer represents all participants connected to a room. Peers can be "local" or "remote"
- `Broadcast` - A local peer can send any message/data to all remote peers in the room

- `Broadcast` - A local peer can send any message/data to all remote peers in the room

## Generating Auth Token

Expand All @@ -115,27 +115,28 @@ Add following permissions in iOS Info.plist file
body: {'room_id': room, 'user_id': user, 'role': Constant.defaultRole});
```

after generating token parse it using json.
after generating the token parse it using JSON.

```dart
var body = json.decode(response.body);
String token = body['token'];
```
You will need this token later explained below.


You will need this token later explained below.

## ♻️ Setup event listeners

100ms SDK provides callbacks to the client app about any change or update happening in the room after a user has joined by implementing `HMSUpdateListener`. These updates can be used to render the video on screen or to display other info regarding the room.
100ms SDK provides callbacks to the client app about any change or update happening in the room after a user has joined by implementing `HMSUpdateListener`. These updates can be used to render the video on the screen or to display other info regarding the room.

```dart
/// 100ms SDK provides callbacks to the client app about any change or update happening in the room after a user has joined by implementing HMSUpdateListener.
/// These updates can be used to render the video on screen or to display other info regarding the room.
/// These updates can be used to render the video on the screen or to display other info regarding the room.
abstract class HMSUpdateListener {
/// This will be called on a successful JOIN of the room by the user
///
/// This is the point where applications can stop showing its loading state
/// This is the point where applications can stop showing their loading state
/// [room]: the room which was joined
void onJoin({required HMSRoom room});
Expand Down Expand Up @@ -173,13 +174,13 @@ abstract class HMSUpdateListener {
/// [message]: the received broadcast message
void onMessage({required HMSMessage message});
/// This is called when someone asks for change or role
/// This is called when someone asks for a change or role
///
/// for eg. admin can ask a peer to become host from guest.
/// this triggers this call on peer's app
void onRoleChangeRequest({required HMSRoleChangeRequest roleChangeRequest});
/// This is called every 1 second with list of active speakers
/// This is called every 1 second with a list of active speakers
///
/// ## A HMSSpeaker object contains -
/// - peerId: the peer identifier of HMSPeer who is speaking
Expand All @@ -203,18 +204,19 @@ abstract class HMSUpdateListener {
void onChangeTrackStateRequest({required HMSTrackChangeRequest hmsTrackChangeRequest});
///when someone kicks you out or when someone ends the room at that time it is triggered
/// [hmsPeerRemovedFromPeer] it consists info about who removed you and why.
/// [hmsPeerRemovedFromPeer] it consists of info about who removed you and why.
void onRemovedFromRoom({required HMSPeerRemovedFromPeer hmsPeerRemovedFromPeer});
}
```

## 🤔 How to listen to Track, Peer and Room updates?
## 🤔 How to listen to Track, Peer and Room updates?

The HMS SDK sends updates to the application about any change in HMSPeer, HMSTrack or HMSRoom via the callbacks in HMSUpdateListener.
Application need to listen to the corresponding updates in onPeerUpdate, onTrackUpdate or onRoomUpdate

The HMS SDK sends updates to the application about any change in HMSPeer , HMSTrack or HMSRoom via the callbacks in HMSUpdateListener.
Application need to listen to the corresponding updates in onPeerUpdate , onTrackUpdate or onRoomUpdate
The following are the different types of updates that are emitted by the SDK -

The following are the different types of updates that are emitted by the SDK -
```dart
HMSPeerUpdate
HMSPeerUpdate.peerJoined: A new peer joins the room
Expand Down Expand Up @@ -242,23 +244,23 @@ HMSRoomUpdate

## 🛤 How to know the type and source of Track?

HMSTrack contain a field called source which denotes the source of the Track.
HMSTrack contains a field called source which denotes the source of the Track.
Source can have the following values - regular (normal), screen (for screenshare)and plugin (for plugins)

To know the type of track, check the value of type which would be one of the enum values - AUDIO or VIDEO

## 🤝 Provide joining configuration

To join a room created by following the steps described in the above section, clients need to create a `HMSConfig` instance and use that instance to call `join` method of `HMSSDK`
To join a room created by following the steps described in the above section, clients need to create an `HMSConfig` instance and use that instance to call the `join` method of `HMSSDK`

```dart
// Create a new HMSConfig
HMSConfig config = HMSConfig(authToken: token,
userName: userName);
```

`token`: follow the above step 1 to generate token.
`userName`: your name using which you want to join the room.
`token`: follow the above step 1 to generate a token.
`userName`: your name using which you want to join the room.

## 🙏 Join a room

Expand Down Expand Up @@ -314,29 +316,33 @@ HMSTrack
```

## 🎞 Display a Track

To display a video track, first get the `HMSVideoTrack` & pass it on to `HMSVideoView` using `setVideoTrack` function. Ensure to attach the `HMSVideoView` to your UI hierarchy.

```dart
HMSVideoView(track: videoTrack);
```

## Change a Role
To change role, you will provide the selected peer and new roleName from roles. If forceChange is true, the system will prompt user for the change. If forceChange is false, user will get a prompt to accept/reject the role.

To change role, you will provide the selected peer and new roleName from roles. If forceChange is true, the system will prompt the user for the change. If forceChange is false, the user will get a prompt to accept/reject the role.
After changeRole is called, HMSUpdateListener's onRoleChangeRequest will be called on selected user's end.

```dart
hmsSDK.changeRole(peer: peer, roleName: roleName, forceChange: true);
```

## 📨 Chat Messaging
You can send a chat or any other kind of message from local peer to all remote peers in the room.

You can send a chat or any other kind of message from a local peer to all remote peers in the room.

To send a message first create an instance of `HMSMessage` object.

Add the information to be sent in the `message` property of `HMSMessage`.

Then use the `void sendBroadcastMessage(message: String)` function on instance of HMSSDK.
Then use the `void sendBroadcastMessage(message: String)` function on the instance of HMSSDK.

When you(the local peer) receives a message from others(any remote peer), ` void onMessage({required HMSMessage message})` function of `HMSUpdateListener` is invoked.
When you(the local peer) receives a message from others(any remote peer), `void onMessage({required HMSMessage message})` function of `HMSUpdateListener` is invoked.

```dart
// following is an example implementation of chat messaging
Expand All @@ -357,25 +363,25 @@ void onMessage({required HMSMessage message}){
🏃‍♀️ Checkout the sample implementation in the [Example app folder](https://github.com/100mslive/100ms-flutter/tree/main/example).

## 🎞 Preview

You can use our preview feature to unmute/mute audio/video before joining the room.

You can implement your own preview listener using this `abstract class HMSPreviewListener`

```dart
```dart
abstract class HMSPreviewListener {
//you will get all error updates here
void onError({required HMSException error});
//here you will get room instance where you are going to join and your own local tracks to render the video by checking the type of trackKind and then using the
//here you will get a room instance where you are going to join and your own local tracks to render the video by checking the type of trackKind and then using the
//above mentioned VideoView widget
void onPreview({required HMSRoom room, required List<HMSTrack> localTracks});
}
```

📖 Read the Complete Documentation here: <https://docs.100ms.live/flutter/v2/foundation/basics>

📖 Read the Complete Documentation here: https://docs.100ms.live/flutter/v2/foundation/basics

📲 Download the Sample iOS app here: https://testflight.apple.com/join/Uhzebmut
📲 Download the Sample iOS app here: <https://testflight.apple.com/join/Uhzebmut>

🤖 Download the Sample Android app here: https://appdistribution.firebase.dev/i/b623e5310929ab70
🤖 Download the Sample Android app here: <https://appdistribution.firebase.dev/i/b623e5310929ab70>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class HMSRoomExtension {
hashMap["hls_streaming_state"] = HMSStreamingState.toDictionary(room.hlsStreamingState)
hashMap["peer_count"] = room.peerCount
hashMap["started_at"] = room.startedAt?:-1
hashMap["session_id"] = room.sessionId
return hashMap
}

Expand Down
12 changes: 6 additions & 6 deletions example/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.589.0)
aws-sdk-core (3.131.0)
aws-partitions (1.595.0)
aws-sdk-core (3.131.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.57.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sigv4 (~> 1.1)
Expand Down Expand Up @@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.206.0)
fastlane (2.206.2)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -146,7 +146,7 @@ GEM
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.6.1)
Expand Down Expand Up @@ -193,7 +193,7 @@ GEM
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.1)
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.7.0)
word_wrap (1.0.0)
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ android {
applicationId "live.hms.flutter"
minSdkVersion 21
targetSdkVersion 32
versionCode 67
versionName "1.1.17"
versionCode 72
versionName "1.1.22"
}

signingConfigs {
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.google.gms:google-services:4.3.10'
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
Binary file removed example/assets/icons/audio.png
Binary file not shown.
3 changes: 3 additions & 0 deletions example/assets/icons/brb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5df13ee

Please sign in to comment.