Skip to content

Commit

Permalink
Merge branch 'main' into v2/remove-deprecated-api
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc authored Dec 22, 2023
2 parents 9dfde5e + adbff11 commit 97a8a91
Show file tree
Hide file tree
Showing 22 changed files with 546 additions and 343 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- run: flutter clean
- run: flutter pub get
- run: |
dart compile js web/e2ee.worker.dart -o example/web/e2ee.worker.dart.js
cd example
flutter build web --release --web-renderer html --base-href /client-sdk-flutter/
cd build/web
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 1.5.5

* Improve reconnect logic for websocket (#406)
* Fix: Prevent ReplayKitChannel related code from being executed on non-iOS platforms. (#432)

## 1.5.4

* Add AudioSourceStats.
Expand Down
4 changes: 3 additions & 1 deletion example/lib/exts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,14 @@ extension LKExampleExt on BuildContext {

enum SimulateScenarioResult {
signalReconnect,
fullReconnect,
speakerUpdate,
nodeFailure,
migration,
serverLeave,
switchCandidate,
clear,
e2eeKeyRatchet,
participantName,
participantMetadata,
clear,
}
27 changes: 18 additions & 9 deletions example/lib/pages/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class _RoomPageState extends State<RoomPage> {
Hardware.instance.setSpeakerphoneOn(true);
}

ReplayKitChannel.listenMethodChannel(widget.room);
if (lkPlatformIs(PlatformType.iOS)) {
ReplayKitChannel.listenMethodChannel(widget.room);
}

if (lkPlatformIsDesktop()) {
onWindowShouldClose = () async {
Expand All @@ -64,7 +66,9 @@ class _RoomPageState extends State<RoomPage> {
void dispose() {
// always dispose listener
(() async {
ReplayKitChannel.closeReplayKit();
if (lkPlatformIs(PlatformType.iOS)) {
ReplayKitChannel.closeReplayKit();
}
widget.room.removeListener(_onRoomDidUpdate);
await _listener.dispose();
await widget.room.dispose();
Expand Down Expand Up @@ -92,6 +96,8 @@ class _RoomPageState extends State<RoomPage> {
})
..on<LocalTrackPublishedEvent>((_) => _sortParticipants())
..on<LocalTrackUnpublishedEvent>((_) => _sortParticipants())
..on<TrackSubscribedEvent>((_) => _sortParticipants())
..on<TrackUnsubscribedEvent>((_) => _sortParticipants())
..on<TrackE2EEStateEvent>(_onE2EEStateEvent)
..on<ParticipantNameUpdatedEvent>((event) {
print(
Expand Down Expand Up @@ -203,22 +209,25 @@ class _RoomPageState extends State<RoomPage> {
if (localParticipantTracks != null) {
for (var t in localParticipantTracks) {
if (t.isScreenShare) {
if (!_flagStartedReplayKit) {
_flagStartedReplayKit = true;
if (lkPlatformIs(PlatformType.iOS)) {
if (!_flagStartedReplayKit) {
_flagStartedReplayKit = true;

ReplayKitChannel.startReplayKit();
ReplayKitChannel.startReplayKit();
}
}

screenTracks.add(ParticipantTrack(
participant: widget.room.localParticipant!,
videoTrack: t.track,
isScreenShare: true,
));
} else {
if (_flagStartedReplayKit) {
_flagStartedReplayKit = false;
if (lkPlatformIs(PlatformType.iOS)) {
if (_flagStartedReplayKit) {
_flagStartedReplayKit = false;

ReplayKitChannel.closeReplayKit();
ReplayKitChannel.closeReplayKit();
}
}

userMediaTracks.add(ParticipantTrack(
Expand Down
4 changes: 4 additions & 0 deletions example/lib/widgets/controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,12 @@ class _ControlsWidgetState extends State<ControlsWidget> {
}

await widget.room.sendSimulateScenario(
speakerUpdate:
result == SimulateScenarioResult.speakerUpdate ? 3 : null,
signalReconnect:
result == SimulateScenarioResult.signalReconnect ? true : null,
fullReconnect:
result == SimulateScenarioResult.fullReconnect ? true : null,
nodeFailure: result == SimulateScenarioResult.nodeFailure ? true : null,
migration: result == SimulateScenarioResult.migration ? true : null,
serverLeave: result == SimulateScenarioResult.serverLeave ? true : null,
Expand Down
4 changes: 1 addition & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ dependencies:
flutter_svg: ^2.0.5
dropdown_button2: ^2.3.6
flutter_window_close: ^0.2.2
collection: '>=1.16.0'

livekit_client:
path: ../
# git:
# url: https://github.com/livekit/client-sdk-flutter
# ref: main

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion ios/livekit_client.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'livekit_client'
s.version = '1.5.4'
s.version = '1.5.5'
s.summary = 'Open source platform for real-time audio and video.'
s.description = 'Open source platform for real-time audio and video.'
s.homepage = 'https://livekit.io/'
Expand Down
Loading

0 comments on commit 97a8a91

Please sign in to comment.