Skip to content

Commit 7c97a29

Browse files
jezelltimu-jesse-ezellcloudwebrtc
authored
Support for WASM builds (#593)
* fix conditionals to support wasm * remove js_util * fix wasm blocking issues * revert name change * cleanup analysis warnings * sort imports * copy e2ee * fix ref to dart_webrtc crypto * fix compile with --wasm. * import sorter. * bump deps version. * fix. * revert changes. * fix analyzer. * fix --------- Co-authored-by: Jesse Ezell <[email protected]> Co-authored-by: cloudwebrtc <[email protected]>
1 parent 8f9e9d7 commit 7c97a29

27 files changed

+10739
-6824
lines changed

.github/workflows/build.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,22 @@ jobs:
152152
- name: Build for Web
153153
working-directory: ./example
154154
run: flutter build web
155+
156+
build-for-web-wasm:
157+
name: Build for Flutter Web WASM
158+
runs-on: ubuntu-latest
159+
160+
steps:
161+
- uses: actions/checkout@v2
162+
- uses: actions/setup-java@v1
163+
with:
164+
java-version: '12.x'
165+
- uses: actions/checkout@v2
166+
- uses: subosito/flutter-action@v2
167+
with:
168+
channel: 'stable'
169+
- name: Install project dependencies
170+
run: flutter pub get
171+
- name: Build for Web
172+
working-directory: ./example
173+
run: flutter build web --wasm

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ proto:
1313
format:
1414
dart format lib/src/proto
1515

16-
e2ee: dart compile js .\web\e2ee.worker.dart -o .\example\web\e2ee.worker.dart.js
16+
e2ee: dart compile js ./web/e2ee.worker.dart -o ./example/web/e2ee.worker.dart.js
1717

1818
.PHONY: proto format

example/lib/main.dart

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_window_close/flutter_window_close.dart';
3-
import 'package:livekit_client/livekit_client.dart';
42
import 'package:livekit_example/theme.dart';
53
import 'package:logging/logging.dart';
64
import 'package:intl/intl.dart';
75
import 'pages/connect.dart';
8-
import 'utils.dart';
96

107
void main() async {
118
final format = DateFormat('HH:mm:ss');
@@ -16,21 +13,19 @@ void main() async {
1613
});
1714

1815
WidgetsFlutterBinding.ensureInitialized();
19-
20-
if (lkPlatformIsDesktop()) {
16+
/*if (lkPlatformIsDesktop()) {
2117
await FlutterWindowClose.setWindowShouldCloseHandler(() async {
2218
await onWindowShouldClose?.call();
2319
return true;
2420
});
25-
}
21+
}*/
2622

2723
/// for livestreaming app, you can initialize the bypassVoiceProcessing = true
2824
/// here to get better audio quality
2925
///
3026
/// await LiveKitClient.initialize(
3127
/// bypassVoiceProcessing: lkPlatformIsMobile(),
3228
/// );
33-
3429
runApp(const LiveKitExampleApp());
3530
}
3631

example/pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ dependencies:
2020
google_fonts: ^6.2.1
2121
flutter_svg: ^2.0.5
2222
dropdown_button2: ^2.3.6
23-
flutter_window_close: ^1.0.0
2423
collection: '>=1.16.0'
2524

2625
livekit_client:

0 commit comments

Comments
 (0)