Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLUT-260: Added SIP support #1742

Merged
merged 10 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/hms_room_kit/lib/src/assets/icons/sip_call.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ import 'package:tuple/tuple.dart';
import 'package:hmssdk_flutter/hmssdk_flutter.dart';

///Project imports
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hms_room_kit/src/widgets/toasts/hms_toasts_type.dart';
import 'package:hms_room_kit/src/layout_api/hms_room_layout.dart';
import 'package:hms_room_kit/src/layout_api/hms_theme_colors.dart';
import 'package:hms_room_kit/src/model/participant_store.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_subheading_text.dart';
import 'package:hms_room_kit/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart';
import 'package:hms_room_kit/src/model/peer_track_node.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_title_text.dart';
import 'package:hms_room_kit/src/meeting/meeting_store.dart';

///[ParticipantsBottomSheet] is the bottom sheet that is shown when the user
Expand Down Expand Up @@ -483,26 +482,47 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
children: [
Selector<
ParticipantsStore,
int>(
selector: (_, participantsStore) => (participantsStore.peer.networkQuality?.quality ??
-1),
bool>(
builder: (_,
networkQuality,
isSIPPeer,
__) {
return networkQuality != -1 && networkQuality < 3
return isSIPPeer
? CircleAvatar(
radius: 16,
backgroundColor: HMSThemeColors.surfaceBright,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/sip_call.svg",
height: 12,
width: 12,
colorFilter: ColorFilter.mode(HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
))
: const SizedBox();
},
selector: (_, participantsStore) =>
participantsStore.peer.type ==
HMSPeerType.sip),
Selector<
ParticipantsStore,
Tuple2<int,
bool>>(
selector: (_, participantsStore) => Tuple2(
participantsStore.peer.networkQuality?.quality ?? -1,
participantsStore.peer.type != HMSPeerType.sip),
builder: (_, participantData, __) {
return participantData.item1 != -1 && participantData.item1 < 3 && participantData.item2
? Padding(
padding: const EdgeInsets.only(right: 16.0),
child: CircleAvatar(
radius: 16,
backgroundColor: HMSThemeColors.surfaceDefault,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/network_$networkQuality.svg",
"packages/hms_room_kit/lib/src/assets/icons/network_${participantData.item1}.svg",
height: 16,
width: 16,
),
),
)
: Container();
: const SizedBox();
}),
Selector<
ParticipantsStore,
Expand All @@ -527,7 +547,7 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
),
),
)
: Container();
: const SizedBox();
}),
_kebabMenu(
currentPeer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:hms_room_kit/src/meeting/meeting_store.dart';
import 'package:hms_room_kit/src/model/peer_track_node.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_cross_button.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_subheading_text.dart';
import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:provider/provider.dart';

///[RemotePeerBottomSheet] is a widget that is used to render the bottom sheet for remote peers
Expand Down Expand Up @@ -188,8 +189,9 @@ class _RemotePeerBottomSheetState extends State<RemotePeerBottomSheet> {
? HMSThemeColors.onSurfaceLowEmphasis
: HMSThemeColors.onSurfaceHighEmphasis)),

if (widget.meetingStore.localPeer?.role.permissions.mute ??
false)
if ((widget.meetingStore.localPeer?.role.permissions.mute ??
false) &&
widget.peerTrackNode.peer.type == HMSPeerType.regular)
ListTile(
horizontalTitleGap: 2,
onTap: () async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ class _RecipientSelectorWidgetState extends State<RecipientSelectorWidget> {
child: Column(
children: data.item1
.where((peer) =>
peer.isLocal == false)

///Don't show local and SIP peers
peer.isLocal == false &&
peer.type != HMSPeerType.sip)
.map((peer) => ListTile(
onTap: () {
setState(() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
///Package imports
library;

///Package import
import 'package:flutter/cupertino.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:hmssdk_flutter/hmssdk_flutter.dart';

///Project imports
import 'package:hms_room_kit/src/layout_api/hms_theme_colors.dart';
import 'package:hms_room_kit/src/model/peer_track_node.dart';
import 'package:hms_room_kit/src/widgets/peer_widgets/network_icon_widget.dart';
import 'package:hms_room_kit/src/widgets/peer_widgets/peer_name.dart';

Expand Down Expand Up @@ -35,6 +39,16 @@ class NameAndNetwork extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
///Phone icon is only rendered if its a SIP peer
if (context.read<PeerTrackNode>().peer.type == HMSPeerType.sip)
Padding(
padding: const EdgeInsets.only(right: 2.0),
child: SvgPicture.asset(
'packages/hms_room_kit/lib/src/assets/icons/sip_call.svg',
height: 12,
semanticsLabel: "fl_sip_call_icon_label",
),
),
PeerName(
maxWidth: maxWidth,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ library;

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';

Expand All @@ -22,20 +23,24 @@ class NetworkIconWidget extends StatelessWidget {
return Selector<PeerTrackNode, Tuple2<int?, bool>>(
builder: (_, networkQuality, __) {
///If the track is degraded, we render the degraded network icon
///If the network quality is not null and not -1, we render the network icon
return networkQuality.item2
? SvgPicture.asset(
'packages/hms_room_kit/lib/src/assets/icons/degraded_network.svg',
height: 20,
semanticsLabel: "fl_network_icon_label",
)
: (networkQuality.item1 != null && networkQuality.item1 != -1)
///If the network quality is not null and not -1,
///and the peer is a regular peer
///we render the network icon
return context.read<PeerTrackNode>().peer.type == HMSPeerType.regular
? networkQuality.item2
? SvgPicture.asset(
'packages/hms_room_kit/lib/src/assets/icons/network_${networkQuality.item1}.svg',
'packages/hms_room_kit/lib/src/assets/icons/degraded_network.svg',
height: 20,
semanticsLabel: "fl_network_icon_label",
)
: Container();
: (networkQuality.item1 != null && networkQuality.item1 != -1)
? SvgPicture.asset(
'packages/hms_room_kit/lib/src/assets/icons/network_${networkQuality.item1}.svg',
height: 20,
semanticsLabel: "fl_network_icon_label",
)
: const SizedBox()
: const SizedBox();
},
selector: (_, peerTrackNode) => Tuple2(peerTrackNode.networkQuality,
peerTrackNode.track?.isDegraded ?? false));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
///Package imports
library;

///Package imports
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';

///Project imports
import 'package:hms_room_kit/src/layout_api/hms_theme_colors.dart';
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hms_room_kit/src/model/peer_track_node.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_subheading_text.dart';

Expand Down
5 changes: 1 addition & 4 deletions packages/hms_room_kit/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ dependencies:
sdk: flutter

hmssdk_flutter:
git:
url: https://github.com/100mslive/100ms-flutter.git
ref: develop
path: packages/hmssdk_flutter
path: ../hmssdk_flutter
intl: ^0.18.0
permission_handler: ^11.0.0
provider: ^6.0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package live.hms.hmssdk_flutter

import live.hms.video.sdk.models.HMSPeer
import live.hms.video.sdk.models.HMSPeerType
import live.hms.video.sdk.models.enums.HMSPeerUpdate

class HMSPeerExtension {
Expand All @@ -14,6 +15,7 @@ class HMSPeerExtension {
args["is_local"] = peer.isLocal
args["role"] = HMSRoleExtension.toDictionary(peer.hmsRole)
args["metadata"] = peer.metadata
args["type"] = getValueFromPeerType(peer.type)
args["is_hand_raised"] = peer.isHandRaised
args["customer_user_id"] = peer.customerUserID
args["audio_track"] = HMSTrackExtension.toDictionary(peer.audioTrack)
Expand Down Expand Up @@ -45,5 +47,13 @@ class HMSPeerExtension {
else -> "defaultUpdate"
}
}

private fun getValueFromPeerType(peerType: HMSPeerType): String {
return when(peerType){
HMSPeerType.SIP -> "sip"
HMSPeerType.REGULAR -> "regular"
else -> "regular"
}
}
}
}
5 changes: 4 additions & 1 deletion packages/hmssdk_flutter/example/ExampleAppChangelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Board: https://100ms.atlassian.net/jira/software/projects/FLUT/boards/34/
- Added active noise cancellation feature
https://100ms.atlassian.net/browse/FLUT-259

- Added SIP Peer support
https://100ms.atlassian.net/browse/FLUT-260

- Fixed: UI inconsistent when using a Screenshare only Role
https://100ms.atlassian.net/browse/FLUT-279

Expand All @@ -12,4 +15,4 @@ https://100ms.atlassian.net/browse/FLUT-280
Room Kit: 1.1.0
Core SDK: 1.10.0
Android SDK: 2.9.52
iOS SDK: 1.7.0
iOS SDK: 1.8.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 461
versionName "1.5.161"
versionCode 462
versionName "1.5.162"
}

signingConfigs {
Expand Down
8 changes: 4 additions & 4 deletions packages/hmssdk_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ PODS:
- HMSHLSPlayerSDK (0.0.2):
- HMSAnalyticsSDK (= 0.0.2)
- HMSNoiseCancellationModels (1.0.0)
- HMSSDK (1.7.0):
- HMSSDK (1.8.0):
- HMSAnalyticsSDK (= 0.0.2)
- HMSWebRTC (= 1.0.5118)
- hmssdk_flutter (1.10.0):
- Flutter
- HMSBroadcastExtensionSDK (= 0.0.9)
- HMSHLSPlayerSDK (= 0.0.2)
- HMSNoiseCancellationModels (= 1.0.0)
- HMSSDK (= 1.7.0)
- HMSSDK (= 1.8.0)
- HMSWebRTC (1.0.5118)
- MLImage (1.0.0-beta4)
- MLKitBarcodeScanning (3.0.0):
Expand Down Expand Up @@ -293,8 +293,8 @@ SPEC CHECKSUMS:
HMSBroadcastExtensionSDK: d80fe325f6c928bd8e5176290b5a4b7ae15d6fbb
HMSHLSPlayerSDK: 6a54ad4d12f3dc2270d1ecd24019d71282a4f6a3
HMSNoiseCancellationModels: a3bda1405a16015632f4bcabd46ce48f35103b02
HMSSDK: 421b4ce83a601bbda283b3b9fbcd1da6898d2a84
hmssdk_flutter: 8f60b63db6286c0b92d9224585362ade6d7e1602
HMSSDK: c893d1381a47ed02760ef6d06625b9aa5251f998
hmssdk_flutter: 997715f0bedfcb22750fb95549672bf3fea380ff
HMSWebRTC: 4487c7200f1e9358412c1d8cd974edd2766467dc
MLImage: 7bb7c4264164ade9bf64f679b40fb29c8f33ee9b
MLKitBarcodeScanning: 04e264482c5f3810cb89ebc134ef6b61e67db505
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1340;
LastUpgradeCheck = 1510;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = 100ms;
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
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.161</string>
<string>1.5.162</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -48,7 +48,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>461</string>
<string>462</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
8 changes: 3 additions & 5 deletions packages/hmssdk_flutter/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,9 @@ packages:
hmssdk_flutter:
dependency: transitive
description:
path: "packages/hmssdk_flutter"
ref: develop
resolved-ref: f23908cdd1254aab1ebe01df6dfc75bdbbd44ae8
url: "https://github.com/100mslive/100ms-flutter.git"
source: git
path: ".."
relative: true
source: path
version: "1.10.0"
http:
dependency: transitive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class HMSPeerExtension {
"peer_id": peer.peerID,
"name": peer.name,
"is_local": peer.isLocal,
"type": getPeerType(peer.type),
"is_hand_raised": peer.isHandRaised,
"customer_description": peer.metadata ?? "",
"customer_user_id": peer.customerUserID ?? "",
Expand Down Expand Up @@ -72,4 +73,15 @@ class HMSPeerExtension {
return "defaultUpdate"
}
}

private static func getPeerType(_ peerType: HMSPeerType) -> String {
switch peerType {
case .sip:
return "sip"
case .regular:
return "regular"
@unknown default:
return "regular"
}
}
}
2 changes: 1 addition & 1 deletion packages/hmssdk_flutter/lib/assets/sdk-versions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"flutter": "1.10.0",
"ios": "1.7.0",
"ios": "1.8.0",
"iOSBroadcastExtension": "0.0.9",
"iOSHLSPlayerSDK": "0.0.2",
"iOSNoiseCancellationModels": "1.0.0",
Expand Down
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 @@ -23,6 +23,7 @@ export 'src/enum/hms_simulcast_layer.dart';
export 'src/enum/hms_audio_mode.dart';
export 'src/enum/hms_hls_playback_state.dart';
export 'src/enum/hms_poll_enum.dart';
export 'src/enum/hms_peer_type.dart';

//EXCEPTIONS
export 'src/exceptions/hms_exception.dart';
Expand Down
Loading