Skip to content

Commit

Permalink
Merge branch 'feature/prebuilt' into feature/ios-isPrebuilt
Browse files Browse the repository at this point in the history
  • Loading branch information
ygit committed Aug 3, 2023
2 parents 2b63fd6 + b12ab8d commit 7bc845b
Show file tree
Hide file tree
Showing 23 changed files with 412 additions and 206 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Flutter

on: #events (push and pull_request)
push:
branches: [ "feature/prebuilt" ]
pull_request:
branches: [ "feature/prebuilt" ]


jobs: #here we specify the jobs - We could have multiple jobs
build: #name it something meaningful
runs-on: macos-latest #runner: select a machine to use

//put down the steps
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'stable'

- name: Install dependencies
run: flutter pub get # action

- name: Run tests
run: flutter test

- name: Build android apk and appBundle
run: flutter build apk

- name: Build android ios
run: flutter build ios --releasee --no-codesign
26 changes: 15 additions & 11 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,34 @@ cli:
plugins:
sources:
- id: trunk
ref: v1.0.0
ref: v1.1.0
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- [email protected]
- git-diff-check
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- git-diff-check
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
runtimes:
enabled:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
actions:
enabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ The default [Example app](https://github.com/100mslive/100ms-flutter/tree/main/e
- iOS 16 or above
- Xcode 14 or above

> Users of iOS devices running Flutter versions 3.10.xx or earlier might experience crashes due to a known issue reported on GitHub [here](https://github.com/flutter/flutter/issues/127489).
## 📱 Supported Devices

- The Android SDK supports Android API level 21 and above. It is built for armeabi-v7a, arm64-v8a, x86, and x86_64 architectures. Devices running Android OS 12 or above is recommended.
Expand Down
194 changes: 189 additions & 5 deletions packages/hms_room_kit/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![100ms-svg](https://user-images.githubusercontent.com/93931528/205858417-8c0a0d1b-2d46-4710-9316-7418092fd3d6.svg)](https://100ms.live/)

[![Pub Version](https://img.shields.io/pub/v/hmssdk_flutter)](https://pub.dev/packages/hmssdk_flutter)
[![HMSLive](https://img.shields.io/pub/v/hmssdk_flutter)](https://pub.dev/packages/hmssdk_flutter)
[![HMSLive Room Kit](https://img.shields.io/pub/v/hms_room_kit)](https://pub.dev/packages/hms_room_kit)
[![License](https://img.shields.io/github/license/100mslive/100ms-flutter)](https://www.100ms.live/)
[![Documentation](https://img.shields.io/badge/Read-Documentation-blue)](https://docs.100ms.live/flutter/v2/foundation/basics)
[![Discord](https://img.shields.io/discord/843749923060711464?label=Join%20on%20Discord)](https://100ms.live/discord)
Expand Down Expand Up @@ -50,12 +51,195 @@ import 'package:hms_room_kit/hmssdk_uikit.dart';

```dart
HMSPrebuilt(
roomCode: meetingLinkController.text.trim(),
hmsConfig: HMSPrebuiltOptions(userName: ""),
);
roomCode: "abc-lmno-xyz",
hmsConfig: HMSPrebuiltOptions(userName: "John Appleseed"),
);
```

That's it. You can now use the amazing prebuilt ui in your application.
## Overview

This guide will walk you through simple instructions to create a video conferencing app using 100ms Prebuilt and and test it using an emulator or your mobile phone.

## Create a sample app

This section contains instructions to create a simple Flutter video conferencing app. We will help you with instructions to understand the project setup and complete code sample to implement this quickly.

### Prerequisites

To complete this implementation for the Android platform, you must have the following:

- A [100ms account](https://dashboard.100ms.live/register) if you don't have one already.
- [Flutter](https://docs.flutter.dev/get-started/install) `3.3.0` or higher
- Dart `2.12.0` or above
- Use [VS code](https://code.visualstudio.com/), [Android Studio](https://developer.android.com/studio), or any other IDE that supports Flutter. For more information on setting up an IDE, check [Flutter's official guide](https://docs.flutter.dev/get-started/editor).

### Create a Flutter app

Once you have the prerequisites, follow the steps below to create a Flutter app. This guide will use VS code, but you can use any IDE that supports Flutter.

- Create a Flutter app using the terminal; you can get the [Flutter SDK](https://docs.flutter.dev/get-started/install/macos#get-sdk) and use the below command:

```bash section=createFlutterApp
flutter create my_app
```

- Once the app is created, open it in VS code.

### Add 100ms room kit to your project

Once you have created a Flutter app, you must add the `hms_room_kit` package to your project.

In project's `pubspec.yaml` file, under dependencies section add the following:
```yaml section=InstallingTheDependencies
hms_room_kit:
```
- Run `flutter pub get` to download these dependencies to your app.
### Application Setup
#### For Android
Please follow the below instructions to test the app for the Android Platform:
1. Add minimum SDK version (`minSdkVersion 21`) in `android/app/build.gradle` file (inside `defaultConfig`).
```json
...
defaultConfig {
...
minSdkVersion 21
...
}
...
```
2. To add PIP support in your app manifest files, add:
```xml
<activity
....
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
... />
```
3. For Auto Enter PIP support(below android 12) in your `MainActivity.kt` file add:
```kotlin
override fun onUserLeaveHint() {
super.onUserLeaveHint()
// This should only work for android version above 8 since PIP is only supported after
// android 8 and will not be called after android 12 since it automatically gets handled by android.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
HMSPipAction.autoEnterPipMode(this)
}
}
```
4. For screenshare in your `MainActivity.kt` add:
```kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == Constants.SCREEN_SHARE_INTENT_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
data?.action = Constants.HMSSDK_RECEIVER
activity.sendBroadcast(data?.putExtra(Constants.METHOD_CALL, Constants.SCREEN_SHARE_REQUEST))
}
}
```
5. Add the `FOREGROUND_SERVICE` permission in `AndroidManifest.xml`:
```xml
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
```
#### For iOS
Please follow the below instructions to test the app for iOS Platform
1. Add the target platform version as (`platform :ios, '12.0'`) in `ios/Podfile`
```json
platform :ios, '12.0'
```
2. To add PIP support in your iOS app:
- Minimum Requirements:
- Minimum iOS version required to support PiP is iOS 15
- Minimum `hmssdk_flutter` SDK version required is 1.3.0
- Your app should have [com.apple.developer.avfoundation.multitasking-camera-access)(https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_avfoundation_multitasking-camera-access) Entitlement to use PiP Mode.
Your app needs to run on iOS 13.5 or later to use the entitlement. Without the entitlement, the system disables the camera access for your app. When your app enters PIP mode, it needs this entitlement to continue using the camera.
After you receive permission from Apple, add the Entitlement to your app by opening the Entitlements file in Xcode. Add the key and set the corresponding value to `YES`.
![Entitlements](https://www.100ms.live/docs/docs/v2/flutter-multitasking-camera-entitlement.png)
3. To add screen share support in iOS app, checkout the docs [here](https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/screen-share#ios-setup)
4. Pass the `iOSScreenshareConfig` in `HMSPrebuiltOptions` parameter of `HMSPrebuilt` widget to enable screen share in your app.
```dart
// Pass the correct App Group & Preferred Extension parameters in HMSIOSScreenshareConfig class.
HMSPrebuilt(
roomCode: meetingLinkController.text.trim(),
options: HMSPrebuiltOptions(
iOSScreenshareConfig: HMSIOSScreenshareConfig(
appGroup: "appGroup", // App Group value linked to your Apple Developer Account
preferredExtension: "preferredExtension" // Name of the Broadcast Upload Extension Target created in Xcode
)));
```
### Add the 100ms Room Kit to your App
We will be adding a join button to the app, on the button click we will route the user to the 100ms room kit. To do this, follow the steps below:
1. Add the below code for `Join` button in `lib/main.dart` file:
```dart
Scaffold(
body: Center(
child: ElevatedButton(
style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
))),
onPressed: () async => {
///Here will route the user to the 100ms room kit
},
child: const Padding(
padding: EdgeInsets.symmetric(vertical: 20, horizontal: 20),
child: Text(
'Join',
style: TextStyle(fontSize: 20),
),
),
),
),
);
```
2. Update the code in the `onPressed` method of the `Join` button by following code:
```dart
onPressed: () async => {
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const HMSPrebuilt(roomCode: "abc-lmno-xyz")
),
),
}
```
That's it. You can now use the amazing Prebuilt UI in your application.

📖 Do refer the Complete Documentation Guide [available here](https://www.100ms.live/docs/flutter/v2/guides/quickstart).

Expand Down
26 changes: 13 additions & 13 deletions packages/hms_room_kit/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ packages:
description:
path: "packages/hmssdk_flutter"
ref: "feature/prebuilt"
resolved-ref: f6e31d444ad4c5d69011c511465fb0515e767bd9
resolved-ref: "92160946ae065f2051322f435c2d6326bee7c7c4"
url: "https://github.com/100mslive/100ms-flutter.git"
source: git
version: "1.8.0"
Expand Down Expand Up @@ -340,26 +340,26 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86"
sha256: "5d44fc3314d969b84816b569070d7ace0f1dea04bd94a83f74c4829615d22ad8"
url: "https://pub.dev"
source: hosted
version: "2.0.27"
version: "2.1.0"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "916731ccbdce44d545414dd9961f26ba5fbaa74bcbb55237d8e65a623a8c7297"
sha256: "1b744d3d774e5a879bb76d6cd1ecee2ba2c6960c03b1020cd35212f6aa267ac5"
url: "https://pub.dev"
source: hosted
version: "2.2.4"
version: "2.3.0"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: ffbb8cc9ed2c9ec0e4b7a541e56fd79b138e8f47d2fb86815f15358a349b3b57
sha256: ba2b77f0c52a33db09fc8caf85b12df691bf28d983e84cf87ff6d693cfa007b3
url: "https://pub.dev"
source: hosted
version: "2.1.11"
version: "2.2.0"
path_provider_platform_interface:
dependency: transitive
description:
Expand All @@ -372,10 +372,10 @@ packages:
dependency: transitive
description:
name: path_provider_windows
sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96"
sha256: ee0e0d164516b90ae1f970bdf29f726f1aa730d7cfc449ecc74c495378b705da
url: "https://pub.dev"
source: hosted
version: "2.1.7"
version: "2.2.0"
permission_handler:
dependency: transitive
description:
Expand Down Expand Up @@ -452,18 +452,18 @@ packages:
dependency: transitive
description:
name: share_plus
sha256: ed3fcea4f789ed95913328e629c0c53e69e80e08b6c24542f1b3576046c614e8
sha256: "6cec740fa0943a826951223e76218df002804adb588235a8910dc3d6b0654e11"
url: "https://pub.dev"
source: hosted
version: "7.0.2"
version: "7.1.0"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: "0c6e61471bd71b04a138b8b588fa388e66d8b005e6f2deda63371c5c505a0981"
sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7"
url: "https://pub.dev"
source: hosted
version: "3.2.1"
version: "3.3.0"
shared_preferences:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class _HLSViewerPageState extends State<HLSViewerPage> {
child:
Padding(
padding: const EdgeInsets
.only(
.only(
right:
10.0,
bottom:
Expand Down Expand Up @@ -396,7 +396,7 @@ class _HLSViewerPageState extends State<HLSViewerPage> {
Padding(
padding:
const EdgeInsets
.only(
.only(
bottom: 20.0),
child: Row(
mainAxisAlignment:
Expand Down
Loading

0 comments on commit 7bc845b

Please sign in to comment.