Skip to content

Commit 13d7e66

Browse files
Brazold3xvn
andauthored
fix: fixed MediaStreamTrack compilation error for web (#657)
* fixed MediaStreamTrack compilation error for web * web version change * webrtc bump * bumping min dart SDK to 3.3.0 * bumping flutter to 3.19 in git workflow * webrtc version bump --------- Co-authored-by: Deven Joshi <[email protected]>
1 parent ab13bea commit 13d7e66

File tree

10 files changed

+33
-32
lines changed

10 files changed

+33
-32
lines changed

.github/workflows/app-distribute.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- dogfooding/**
99

1010
env:
11-
FLUTTER_VERSION: '3.16.9'
11+
FLUTTER_VERSION: '3.19.5'
1212
FLUTTER_CHANNEL: stable
1313
ENV_PROPERTIES: ${{ secrets.ENV_PROPERTIES }}
1414
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}

.github/workflows/legacy_version_analyze.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: legacy_version_analyze
33
env:
44
# Note: The versions below should be manually updated after a new stable
55
# version comes out.
6-
flutter_version: "3.16.0"
6+
flutter_version: "3.19.5"
77

88
on:
99
push:

.github/workflows/stream_video_flutter_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: stream_video_flutter_workflow
22

33
env:
44
FLUTTER_CHANNEL: stable
5-
FLUTTER_VERSION: 3.16.0
5+
FLUTTER_VERSION: 3.19.5
66
ENV_PROPERTIES: ${{ secrets.ENV_PROPERTIES }}
77

88
on:

dogfooding/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ publish_to: none
44
description: Flutter Dogfooding App to showcase Video SDK.
55

66
environment:
7-
sdk: '>=3.0.0 <4.0.0'
7+
sdk: '>=3.3.0 <4.0.0'
88
flutter: '>=3.16.0'
99

1010
dependencies:
@@ -29,8 +29,8 @@ dependencies:
2929
share_plus: ^7.1.0
3030
shared_preferences: ^2.2.0
3131
stream_chat_flutter: ^7.1.0
32-
stream_video_flutter: ^0.3.8
33-
stream_video_push_notification: ^0.3.8
32+
stream_video_flutter: ^0.3.9
33+
stream_video_push_notification: ^0.3.9
3434
uni_links: ^0.5.1
3535

3636
dev_dependencies:
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// ignore_for_file: avoid_web_libraries_in_flutter, implementation_imports
22

3-
import 'dart:html' as html;
43
import 'dart:js_util' as jsutil;
54

65
import 'package:dart_webrtc/src/media_stream_track_impl.dart';
76
import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
7+
import 'package:web/web.dart' as web;
88

99
const audioContainerId = 'stream_audio_container';
1010
const audioPrefix = 'stream_audio_';
@@ -13,46 +13,46 @@ void startAudio(String id, rtc.MediaStreamTrack track) {
1313
if (track is! MediaStreamTrackWeb) return;
1414

1515
final elementId = audioPrefix + id;
16-
var audioElement = html.document.getElementById(elementId);
16+
var audioElement = web.document.getElementById(elementId);
1717
if (audioElement == null) {
18-
audioElement = html.AudioElement()
18+
audioElement = web.HTMLAudioElement()
1919
..id = elementId
2020
..autoplay = true;
2121
findOrCreateAudioContainer().append(audioElement);
2222
}
2323

24-
if (audioElement is! html.AudioElement) return;
24+
if (audioElement is! web.HTMLAudioElement) return;
2525

26-
final audioStream = html.MediaStream();
26+
final audioStream = web.MediaStream();
2727
audioStream.addTrack(track.jsTrack);
2828
audioElement.srcObject = audioStream;
2929
}
3030

3131
void stopAudio(String id) {
32-
final audioElement = html.document.getElementById(audioPrefix + id);
32+
final audioElement = web.document.getElementById(audioPrefix + id);
3333
if (audioElement != null) {
34-
if (audioElement is html.AudioElement) {
34+
if (audioElement is web.HTMLAudioElement) {
3535
audioElement.srcObject = null;
3636
}
3737
audioElement.remove();
3838
}
3939
}
4040

4141
void setSinkId(String id, String deviceId) {
42-
final audioElement = html.document.getElementById(audioPrefix + id);
43-
if (audioElement is html.AudioElement &&
42+
final audioElement = web.document.getElementById(audioPrefix + id);
43+
if (audioElement is web.HTMLAudioElement &&
4444
jsutil.hasProperty(audioElement, 'setSinkId')) {
45-
audioElement.setSinkId(deviceId);
45+
jsutil.setProperty(audioElement, 'setSinkId', deviceId);
4646
}
4747
}
4848

49-
html.DivElement findOrCreateAudioContainer() {
50-
var div = html.document.getElementById(audioContainerId);
51-
if (div != null) return div as html.DivElement;
49+
web.HTMLDivElement findOrCreateAudioContainer() {
50+
var div = web.document.getElementById(audioContainerId);
51+
if (div != null) return div as web.HTMLDivElement;
5252

53-
div = html.DivElement()
53+
div = web.HTMLDivElement()
5454
..id = audioContainerId
5555
..style.display = 'none';
56-
html.document.body?.append(div);
57-
return div as html.DivElement;
56+
web.document.body?.append(div);
57+
return div as web.HTMLDivElement;
5858
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is generated. Do not manually edit.
22
/// Current package version.
33
const String streamVideoVersion = '0.3.9';
4-
const String androidWebRTCVersion = 'libwebrtc-m114.5735.08';
5-
const String iosWebRTCVersion = 'libwebrtc-m114.5735.08';
4+
const String androidWebRTCVersion = 'libwebrtc-m114.5735.10';
5+
const String iosWebRTCVersion = 'libwebrtc-m114.5735.10';

packages/stream_video/pubspec.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ repository: https://github.com/GetStream/stream-video-flutter
77
issue_tracker: https://github.com/GetStream/stream-video-flutter/issues
88

99
environment:
10-
sdk: ">=3.0.0 <4.0.0"
10+
sdk: ">=3.3.0 <4.0.0"
1111
flutter: ">=3.16.0"
1212

1313
dependencies:
1414
async: ^2.11.0
1515
collection: ^1.18.0
1616
connectivity_plus: ^5.0.2
17-
dart_webrtc: ^1.1.3
17+
dart_webrtc: ^1.4.0
1818
equatable: ^2.0.5
1919
fixnum: ^1.1.0
2020
flutter:
2121
sdk: flutter
22-
flutter_webrtc: 0.9.47
22+
flutter_webrtc: ^0.10.4
2323
http: ^1.1.0
2424
internet_connection_checker: ^1.0.0+1
2525
intl: ">=0.18.1 <=0.19.0"
@@ -32,6 +32,7 @@ dependencies:
3232
synchronized: ^3.1.0
3333
tart: ^0.5.1
3434
uuid: ^4.2.1
35+
web: ^0.5.1
3536
web_socket_channel: ^2.4.0
3637
webrtc_interface: ^1.1.1
3738

packages/stream_video_flutter/example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
88
version: 1.0.0+1
99

1010
environment:
11-
sdk: ">=3.0.0 <4.0.0"
11+
sdk: ">=3.3.0 <4.0.0"
1212
flutter: ">=3.16.0"
1313

1414
dependencies:
@@ -18,7 +18,7 @@ dependencies:
1818
flutter:
1919
sdk: flutter
2020
flutter_svg: ^2.0.7
21-
flutter_webrtc: 0.9.47
21+
flutter_webrtc: ^0.10.4
2222
google_fonts: ^5.1.0
2323
http: ^1.1.0
2424
intl: ^0.19.0

packages/stream_video_flutter/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repository: https://github.com/GetStream/stream-video-flutter
77
issue_tracker: https://github.com/GetStream/stream-video-flutter/issues
88

99
environment:
10-
sdk: ">=3.0.0 <4.0.0"
10+
sdk: ">=3.3.0 <4.0.0"
1111
flutter: ">=3.16.0"
1212

1313
dependencies:
@@ -16,7 +16,7 @@ dependencies:
1616
equatable: ^2.0.5
1717
flutter:
1818
sdk: flutter
19-
flutter_webrtc: 0.9.47
19+
flutter_webrtc: ^0.10.4
2020
plugin_platform_interface: ^2.1.7
2121
rate_limiter: ^1.0.0
2222
stream_video: ^0.3.9

packages/stream_video_push_notification/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repository: https://github.com/GetStream/stream-video-flutter
77
issue_tracker: https://github.com/GetStream/stream-video-flutter/issues
88

99
environment:
10-
sdk: ">=3.0.0 <4.0.0"
10+
sdk: ">=3.3.0 <4.0.0"
1111
flutter: ">=3.16.0"
1212

1313
dependencies:

0 commit comments

Comments
 (0)