Skip to content

Commit

Permalink
Added whiteboard sdk changes (#1767)
Browse files Browse the repository at this point in the history
* Added whiteboard sdk changes

* 🤖 Automated Format and Fix

* Fixed android whiteboard issue

* Updated version numbers

* 🤖 Automated Format and Fix

* released sample app version 1.5.193 (493) 🍀

* 🤖 Automated Format and Fix

* Removed unused await

* Updated methods

* Fixed widget errors

* 🤖 Automated Format and Fix

* fixed flutter version in yaml

* Removed 3.22 code updates

* 🤖 Automated Format and Fix

* Updated date

---------

Co-authored-by: Decoder07 <[email protected]>
Co-authored-by: Yogesh Singh <[email protected]>
  • Loading branch information
3 people authored May 15, 2024
1 parent ce34e61 commit ed09cbc
Show file tree
Hide file tree
Showing 22 changed files with 210 additions and 88 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.13.9
cache: true
- name: Get Flutter dependencies in Core SDK
run: flutter pub get
Expand Down
19 changes: 19 additions & 0 deletions packages/hms_room_kit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@
| hms_room_kit | [![Pub Version](https://img.shields.io/pub/v/hms_room_kit)](https://pub.dev/packages/hms_room_kit) |
| hmssdk_flutter | [![Pub Version](https://img.shields.io/pub/v/hmssdk_flutter)](https://pub.dev/packages/hmssdk_flutter) |

## 1.1.2 - 2024-05-15

| Package | Version |
| -------------- | ------------------------------------------------------------------------------------------------------ |
| hms_room_kit | 1.1.2 |
| hmssdk_flutter | 1.10.2 |

### 🚀 Added

- Whiteboard support in Prebuilt

Prebuilt now supports whiteboard for better collaboration. Users can create, manage, and stop whiteboards directly from the prebuilt interface.

- Introducing option to select layers in HLS Player

HLS Player now supports layer selection from HLS Player Settings.

Uses `hmssdk_flutter` package version 1.10.2

## 1.1.1 - 2024-04-26

| Package | Version |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class HLSPlayerStore extends ChangeNotifier
///[setHLSLayer] sets the HLS Layer
void setHLSLayer(HMSHLSLayer hmsHLSLayer) async {
selectedLayer = hmsHLSLayer;
await HMSHLSPlayerController.setHLSLayer(hmsHLSLayer: hmsHLSLayer);
HMSHLSPlayerController.setHLSLayer(hmsHLSLayer: hmsHLSLayer);
notifyListeners();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/hms_room_kit/lib/src/meeting/meeting_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,7 @@ class MeetingStore extends ChangeNotifier

void toggleWhiteboard() async {
if (isWhiteboardEnabled) {
if (localPeer?.peerId == whiteboardModel?.owner?.peerId) {
if (whiteboardModel?.isOwner ?? false) {
HMSException? error = await HMSWhiteboardController.stop();
if (error != null) {
log("HMSWhiteboardController.stop error: ${error.description}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class _AppUtilitiesBottomSheetState extends State<AppUtilitiesBottomSheet> {
///we return low emphasis color since whiteboard can't be turned ON
///In other cases we return high emphasis color
return meetingStore.isWhiteboardEnabled
? meetingStore.whiteboardModel?.owner?.customerUserId ==
meetingStore.localPeer?.customerUserId
? meetingStore.whiteboardModel?.isOwner ?? false
? HMSThemeColors.onSurfaceHighEmphasis
: HMSThemeColors.onSurfaceLowEmphasis
: meetingStore.screenShareCount > 0 || meetingStore.isScreenShareOn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,43 @@ import 'package:webview_flutter/webview_flutter.dart';
import 'package:hms_room_kit/src/meeting/meeting_store.dart';

///[WhiteboardWebView] is a widget that renders the whiteboard webview
class WhiteboardWebView extends StatelessWidget {
class WhiteboardWebView extends StatefulWidget {
const WhiteboardWebView({Key? key}) : super(key: key);

@override
State<WhiteboardWebView> createState() => _WhiteboardWebViewState();
}

class _WhiteboardWebViewState extends State<WhiteboardWebView> {
late WebViewController _controller;

@override
void initState() {
super.initState();
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onNavigationRequest: (_) {
return NavigationDecision.navigate;
},
onProgress: (int progress) {},
onPageStarted: (String url) {},
onPageFinished: (String url) {},
onWebResourceError: (WebResourceError error) {
log("Error occured in whiteboard tile: ${error.description}");
},
),
);
}

@override
void dispose() {
_controller.loadHtmlString("https://www.100ms.live/");
super.dispose();
}

@override
Widget build(BuildContext context) {
return Selector<MeetingStore, String?>(
Expand All @@ -23,23 +57,7 @@ class WhiteboardWebView extends StatelessWidget {
///If the url is not null we render the webview
return url != null
? WebViewWidget(
controller: WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onNavigationRequest: (_) {
return NavigationDecision.navigate;
},
onProgress: (int progress) {},
onPageStarted: (String url) {},
onPageFinished: (String url) {},
onWebResourceError: (WebResourceError error) {
log("Error occured in whiteboard tile: ${error.description}");
},
),
)
..loadRequest(Uri.parse(url)))
controller: _controller..loadRequest(Uri.parse(url)))
: const SizedBox();
});
}
Expand Down
25 changes: 25 additions & 0 deletions packages/hmssdk_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@
| hms_room_kit | [![Pub Version](https://img.shields.io/pub/v/hms_room_kit)](https://pub.dev/packages/hms_room_kit) |
| hmssdk_flutter | [![Pub Version](https://img.shields.io/pub/v/hmssdk_flutter)](https://pub.dev/packages/hmssdk_flutter) |

# 1.10.2 - 2024-05-15

| Package | Version |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| hms_room_kit | 1.1.2 |
| hmssdk_flutter | 1.10.2 |

### ✨ Added

- Introducing Whiteboard support in HMSSDK

HMSSDK now provides support for Whiteboard. You can now start/stop a whiteboard using `HMSWhiteboardController` methods. HMSSDK provides also provides callbacks for whiteboard start/stop events. Learn more about it [here](https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/whiteboard)

- HLS Layer methods

HLS Stream Layers can be controlled using the HMSHLSPlayerController's `getHLSLayers` and `setHLSLayer` methods. Learn more about the methods [here](https://www.100ms.live/docs/flutter/v2/how-to-guides/record-and-live-stream/hls-player)

- `onPeerListUpdate` event on `HMSPreviewListener`

The `onPeerListUpdate` event is now available on `HMSPreviewListener` to get updates on the peer list. Learn more about it [here](https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/preview#supplementary-bytes)

Uses Android SDK 2.9.56 & iOS SDK 1.10.0

**Full Changelog**: [1.10.1...1.10.2](https://github.com/100mslive/100ms-flutter/compare/1.10.1...1.10.2)

# 1.10.1 - 2024-04-26

| Package | Version |
Expand Down
12 changes: 4 additions & 8 deletions packages/hmssdk_flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@ android {
}

dependencies {
implementation "com.github.100mslive.android-sdk:video-view:dev-v2-SNAPSHOT"
implementation "com.github.100mslive.android-sdk:hls-player:dev-v2-SNAPSHOT"
implementation 'com.github.100mslive.android-sdk:android-sdk:dev-v2-SNAPSHOT'
implementation "com.github.100mslive.android-sdk:hms-noise-cancellation-android:dev-v2-SNAPSHOT"
// implementation "live.100ms:android-sdk:${sdkVersions['android']}"
// implementation "live.100ms:video-view:${sdkVersions['android']}"
// implementation "live.100ms:hls-player:${sdkVersions['android']}"
// implementation "live.100ms:hms-noise-cancellation-android:${sdkVersions['android']}"
implementation "live.100ms:android-sdk:${sdkVersions['android']}"
implementation "live.100ms:video-view:${sdkVersions['android']}"
implementation "live.100ms:hls-player:${sdkVersions['android']}"
implementation "live.100ms:hms-noise-cancellation-android:${sdkVersions['android']}"
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package live.hms.hmssdk_flutter

import live.hms.video.sdk.models.HMSPeer
import live.hms.video.whiteboard.HMSWhiteboard
import live.hms.video.whiteboard.State

class HMSWhiteboardExtension {
companion object{
Expand All @@ -18,8 +19,17 @@ class HMSWhiteboardExtension {
whiteboardMap["owner"] = HMSPeerExtension.toDictionary(hmsWhiteboard.owner)
whiteboardMap["title"] = hmsWhiteboard.title
whiteboardMap["url"] = hmsWhiteboard.url

whiteboardMap["state"] = getStateFromString(hmsWhiteboard.state)
whiteboardMap["is_owner"] = hmsWhiteboard.isOwner
return whiteboardMap
}

private fun getStateFromString(state: State): String{
return when(state){
State.Started -> "started"
State.Stopped -> "stopped"
else -> "stopped"
}
}
}
}
2 changes: 1 addition & 1 deletion packages/hmssdk_flutter/example/ExampleAppChangelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ https://100ms.atlassian.net/browse/FLUT-284

Room Kit: 1.1.2
Core SDK: 1.10.2
Android SDK: 2.9.55
Android SDK: 2.9.56
iOS SDK: 1.10.0
4 changes: 2 additions & 2 deletions packages/hmssdk_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ android {
applicationId "live.hms.flutter"
minSdkVersion 21
targetSdkVersion 34
versionCode 491
versionName "1.5.191"
versionCode 493
versionName "1.5.193"
}

signingConfigs {
Expand Down
4 changes: 2 additions & 2 deletions packages/hmssdk_flutter/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.190</string>
<string>1.5.193</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -48,7 +48,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>490</string>
<string>493</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import HMSSDK

class HMSWhiteboardExtension{

static func toDictionary(hmsWhiteboard: HMSWhiteboard?) -> [String: Any?]?{
static func toDictionary(hmsWhiteboard: HMSWhiteboard?,hmsSDK: HMSSDK?) -> [String: Any?]?{

guard let whiteboard = hmsWhiteboard else{
return nil
Expand All @@ -25,7 +25,20 @@ class HMSWhiteboardExtension{
}
args["title"] = hmsWhiteboard?.title
args["url"] = hmsWhiteboard?.url?.absoluteString
args["is_owner"] = hmsWhiteboard?.owner?.customerUserID == hmsSDK?.localPeer?.customerUserID
args["state"] = getStateFromString(state: hmsWhiteboard?.state)

return args
}

private static func getStateFromString(state: HMSWhiteboard.WhiteboardState?) -> String{
switch(state){
case .started:
return "started"
case .stopped:
return "stopped"
default:
return "stopped"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,14 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene
case .started:
let args = [
"event_name": "on_whiteboard_start",
"data": HMSWhiteboardExtension.toDictionary(hmsWhiteboard: hmsWhiteboard)
"data": HMSWhiteboardExtension.toDictionary(hmsWhiteboard: hmsWhiteboard, hmsSDK: hmsSDK)
]
self.whiteboardEventSink?(args)
break
case .stopped:
let args = [
"event_name": "on_whiteboard_stop",
"data": HMSWhiteboardExtension.toDictionary(hmsWhiteboard: hmsWhiteboard)
"data": HMSWhiteboardExtension.toDictionary(hmsWhiteboard: hmsWhiteboard, hmsSDK: hmsSDK)
]
self.whiteboardEventSink?(args)
break
Expand Down
4 changes: 2 additions & 2 deletions packages/hmssdk_flutter/lib/assets/sdk-versions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"flutter": "1.10.1",
"flutter": "1.10.2",
"ios": "1.10.0",
"iOSBroadcastExtension": "0.0.9",
"iOSHLSPlayerSDK": "0.0.2",
"iOSNoiseCancellationModels": "1.0.0",
"android": "2.9.55"
"android": "2.9.56"
}
1 change: 1 addition & 0 deletions packages/hmssdk_flutter/lib/hmssdk_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export 'src/enum/hms_poll_enum.dart';
export 'src/enum/hms_peer_type.dart';
export 'src/enum/hms_hls_playlist_type.dart';
export 'src/enum/hms_whiteboard_listener_method.dart';
export 'src/enum/hms_whiteboard_state.dart';

//EXCEPTIONS
export 'src/exceptions/hms_exception.dart';
Expand Down
15 changes: 15 additions & 0 deletions packages/hmssdk_flutter/lib/src/enum/hms_whiteboard_state.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
///[HMSWhiteboardState] enum is used to define the state of the whiteboard
enum HMSWhiteboardState { started, stopped }

extension HMSWhiteboardStateValues on HMSWhiteboardState {
static HMSWhiteboardState getWhiteboardStateFromName(String name) {
switch (name) {
case "started":
return HMSWhiteboardState.started;
case "stopped":
return HMSWhiteboardState.stopped;
default:
return HMSWhiteboardState.stopped;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
// Project imports
import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:hmssdk_flutter/src/service/platform_service.dart';

///[HMSWhiteboardController] class contains methods to control the Whiteboard
class HMSWhiteboardController {
/// Starts the Whiteboard with the specified [title].
/// **parameters**:
///
/// **title** - title of the whiteboard
///
/// Refer [Start Whiteboard](https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/whiteboard#start-whiteboard)
static Future<HMSException?> start({required String title}) async {
var result = await PlatformService.invokeMethod(
PlatformMethod.startWhiteboard,
Expand All @@ -14,6 +22,9 @@ class HMSWhiteboardController {
}
}

/// Stops the Whiteboard.
///
/// Refer [Stop Whiteboard](https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/whiteboard#stop-whiteboard)
static Future<HMSException?> stop() async {
var result =
await PlatformService.invokeMethod(PlatformMethod.stopWhiteboard);
Expand All @@ -25,11 +36,21 @@ class HMSWhiteboardController {
}
}

/// Adds an [HMSWhiteboardUpdateListener] to listen for Whiteboard updates.
///
/// **parameters**:
///
/// **listener** - whiteboard update listener to be attached
///
/// Refer [Whiteboard Update Listener](https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/whiteboard#how-to-display-whiteboard)
static void addHMSWhiteboardUpdateListener(
{required HMSWhiteboardUpdateListener listener}) {
PlatformService.addWhiteboardUpdateListener(listener);
}

/// Removes an [HMSWhiteboardUpdateListener] that was previously added.
///
/// Refer [Whiteboard Update Listener](https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/whiteboard#how-to-display-whiteboard)
static void removeHMSWhiteboardUpdateListener() {
PlatformService.removeWhiteboardUpdateListener();
}
Expand Down
Loading

0 comments on commit ed09cbc

Please sign in to comment.