Skip to content

Commit d6768f5

Browse files
[flutter_webrtc] Update libwebrtc to m114 version (#625)
Co-authored-by: xiaowei guan <[email protected]>
1 parent bc4d708 commit d6768f5

36 files changed

+1142
-824
lines changed

packages/flutter_webrtc/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
## NEXT
1+
## 0.1.3
22

33
* Increase the minimum Flutter version to 3.3.
4+
* Update libwebrtc to m114 version.
5+
* Update flutter_webrtc to 0.9.46.
6+
* Update and format flutter_webrtc_demo.
7+
* Support the empty candidate for 'addIceCandidate' api.
48

59
## 0.1.2
610

packages/flutter_webrtc/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ For other Tizen devices :
4040

4141
```yaml
4242
dependencies:
43-
flutter_webrtc: ^0.9.28
44-
flutter_webrtc_tizen: ^0.1.2
43+
flutter_webrtc: ^0.9.46
44+
flutter_webrtc_tizen: ^0.1.3
4545
```
4646
4747
## Functionality
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
# flutter-webrtc-demo
2-
32
[![slack](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://join.slack.com/t/flutterwebrtc/shared_invite/zt-q83o7y1s-FExGLWEvtkPKM8ku_F8cEQ)
43

54
Flutter WebRTC plugin Demo
65

7-
Online Demo: <https://demo.cloudwebrtc.com:8086/>
6+
Online Demo: https://flutter-webrtc.github.io/flutter-webrtc-demo/
87

98
## Usage
10-
9+
- `cd flutter_webrtc_demo`
10+
- `flutter-tizen pub get`
1111
- `flutter-tizen run`
1212

1313
## Note
14-
1514
- If you want to test `P2P Call Sample`, please use the [webrtc-flutter-server](https://github.com/cloudwebrtc/flutter-webrtc-server), and enter your server address into the example app.
1615

1716
## screenshots
18-
19-
### iOS
20-
17+
# iOS
2118
<img width="180" height="320" src="https://raw.githubusercontent.com/cloudwebrtc/flutter-webrtc-demo/master/screenshots/flutter-webrtc-ios-example.png"/> <img width="180" height="320" src="https://raw.githubusercontent.com/cloudwebrtc/flutter-webrtc-demo/master/screenshots/ios-01.jpeg"/> <img width="180" height="320" src="https://raw.githubusercontent.com/cloudwebrtc/flutter-webrtc-demo/master/screenshots/ios-02.jpeg"/>
2219

23-
### Android
24-
20+
# Android
2521
<img width="180" height="320" src="https://raw.githubusercontent.com/cloudwebrtc/flutter-webrtc-demo/master/screenshots/flutter-webrtc-android-example.png"/> <img width="180" height="320" src="https://raw.githubusercontent.com/cloudwebrtc/flutter-webrtc-demo/master/screenshots/android-01.png"/> <img width="180" height="320" src="https://raw.githubusercontent.com/cloudwebrtc/flutter-webrtc-demo/master/screenshots/android-02.png"/>

packages/flutter_webrtc/example/flutter_webrtc_demo/analysis_options.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,3 @@ analyzer:
4040
# allow self-reference to deprecated members (we do this because otherwise we have
4141
# to annotate every member in every test, assert, etc, when we deprecate something)
4242
deprecated_member_use_from_same_package: ignore
43-
# Ignore analyzer hints for updating pubspecs when using Future or
44-
# Stream and not importing dart:async
45-
# Please see https://github.com/flutter/flutter/pull/24528 for details.
46-
sdk_version_async_exported_from_core: ignore

packages/flutter_webrtc/example/flutter_webrtc_demo/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class _MyAppState extends State<MyApp> {
3232
_initItems();
3333
}
3434

35-
ListBody _buildRow(context, item) {
35+
Widget _buildRow(context, item) {
3636
return ListBody(children: <Widget>[
3737
ListTile(
3838
title: Text(item.title),

packages/flutter_webrtc/example/flutter_webrtc_demo/lib/src/call_sample/call_sample.dart

Lines changed: 80 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class _CallSampleState extends State<CallSample> {
2424
final RTCVideoRenderer _remoteRenderer = RTCVideoRenderer();
2525
bool _inCalling = false;
2626
Session? _session;
27-
2827
bool _waitAccept = false;
2928

3029
@override
@@ -42,6 +41,9 @@ class _CallSampleState extends State<CallSample> {
4241
@override
4342
void deactivate() {
4443
super.deactivate();
44+
if (_inCalling) {
45+
_hangUp();
46+
}
4547
_signaling?.close();
4648
_localRenderer.dispose();
4749
_remoteRenderer.dispose();
@@ -92,7 +94,7 @@ class _CallSampleState extends State<CallSample> {
9294
break;
9395
case CallState.CallStateInvite:
9496
_waitAccept = true;
95-
await _showInvateDialog();
97+
await _showInviteDialog();
9698
break;
9799
case CallState.CallStateConnected:
98100
if (_waitAccept) {
@@ -156,7 +158,7 @@ class _CallSampleState extends State<CallSample> {
156158
);
157159
}
158160

159-
Future<bool?> _showInvateDialog() {
161+
Future<bool?> _showInviteDialog() {
160162
return showDialog<bool?>(
161163
context: context,
162164
builder: (context) {
@@ -276,96 +278,86 @@ class _CallSampleState extends State<CallSample> {
276278
]);
277279
}
278280

279-
Future<bool> _onWillPop(BuildContext context) async {
280-
if (_inCalling) {
281-
_hangUp();
282-
}
283-
return true;
284-
}
285-
286281
@override
287282
Widget build(BuildContext context) {
288-
return WillPopScope(
289-
onWillPop: () => _onWillPop(context),
290-
child: Scaffold(
291-
appBar: AppBar(
292-
title: Text(
293-
'P2P Call Sample${_selfId != null ? ' [Your ID ($_selfId)] ' : ''}'),
294-
actions: <Widget>[
295-
IconButton(
296-
icon: const Icon(Icons.settings),
297-
onPressed: null,
298-
tooltip: 'setup',
299-
),
300-
],
301-
),
302-
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
303-
floatingActionButton: _inCalling
304-
? SizedBox(
305-
width: 240.0,
283+
return Scaffold(
284+
appBar: AppBar(
285+
title: Text(
286+
'P2P Call Sample${_selfId != null ? ' [Your ID ($_selfId)] ' : ''}'),
287+
actions: <Widget>[
288+
IconButton(
289+
icon: const Icon(Icons.settings),
290+
onPressed: null,
291+
tooltip: 'setup',
292+
),
293+
],
294+
),
295+
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
296+
floatingActionButton: _inCalling
297+
? SizedBox(
298+
width: 240.0,
299+
child: Row(
300+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
301+
children: <Widget>[
302+
FloatingActionButton(
303+
tooltip: 'Camera',
304+
onPressed: _switchCamera,
305+
child: const Icon(Icons.switch_camera),
306+
),
307+
FloatingActionButton(
308+
tooltip: 'Screen Sharing',
309+
onPressed: () => selectScreenSourceDialog(context),
310+
child: const Icon(Icons.desktop_mac),
311+
),
312+
FloatingActionButton(
313+
onPressed: _hangUp,
314+
tooltip: 'Hangup',
315+
backgroundColor: Colors.pink,
316+
child: Icon(Icons.call_end),
317+
),
318+
FloatingActionButton(
319+
tooltip: 'Mute Mic',
320+
onPressed: _muteMic,
321+
child: const Icon(Icons.mic_off),
322+
)
323+
]))
324+
: null,
325+
body: _inCalling
326+
? OrientationBuilder(builder: (context, orientation) {
327+
return Container(
328+
width: MediaQuery.of(context).size.width,
329+
height: MediaQuery.of(context).size.height,
306330
child: Row(
307-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
308-
children: <Widget>[
309-
FloatingActionButton(
310-
tooltip: 'Camera',
311-
onPressed: _switchCamera,
312-
child: const Icon(Icons.switch_camera),
313-
),
314-
FloatingActionButton(
315-
tooltip: 'Screen Sharing',
316-
onPressed: () => selectScreenSourceDialog(context),
317-
child: const Icon(Icons.desktop_mac),
331+
children: <Widget>[
332+
Expanded(
333+
flex: 1,
334+
child: Container(
335+
alignment: Alignment.center,
336+
padding: const EdgeInsets.all(8.0),
337+
decoration: BoxDecoration(color: Colors.black54),
338+
child: RTCVideoView(_localRenderer),
318339
),
319-
FloatingActionButton(
320-
onPressed: _hangUp,
321-
tooltip: 'Hangup',
322-
backgroundColor: Colors.pink,
323-
child: Icon(Icons.call_end),
340+
),
341+
Expanded(
342+
flex: 1,
343+
child: Container(
344+
alignment: Alignment.center,
345+
padding: const EdgeInsets.all(8.0),
346+
decoration: BoxDecoration(color: Colors.black54),
347+
child: RTCVideoView(_remoteRenderer),
324348
),
325-
FloatingActionButton(
326-
tooltip: 'Mute Mic',
327-
onPressed: _muteMic,
328-
child: const Icon(Icons.mic_off),
329-
)
330-
]))
331-
: null,
332-
body: _inCalling
333-
? OrientationBuilder(builder: (context, orientation) {
334-
return Container(
335-
width: MediaQuery.of(context).size.width,
336-
height: MediaQuery.of(context).size.height,
337-
child: Row(
338-
children: <Widget>[
339-
Expanded(
340-
flex: 1,
341-
child: Container(
342-
alignment: Alignment.center,
343-
padding: const EdgeInsets.all(8.0),
344-
decoration: BoxDecoration(color: Colors.black54),
345-
child: RTCVideoView(_localRenderer),
346-
),
347-
),
348-
Expanded(
349-
flex: 1,
350-
child: Container(
351-
alignment: Alignment.center,
352-
padding: const EdgeInsets.all(8.0),
353-
decoration: BoxDecoration(color: Colors.black54),
354-
child: RTCVideoView(_remoteRenderer),
355-
),
356-
),
357-
],
358-
),
359-
);
360-
})
361-
: ListView.builder(
362-
shrinkWrap: true,
363-
padding: const EdgeInsets.all(0.0),
364-
itemCount: _peers.length,
365-
itemBuilder: (context, i) {
366-
return _buildRow(context, _peers[i]);
367-
}),
368-
),
349+
),
350+
],
351+
),
352+
);
353+
})
354+
: ListView.builder(
355+
shrinkWrap: true,
356+
padding: const EdgeInsets.all(0.0),
357+
itemCount: _peers.length,
358+
itemBuilder: (context, i) {
359+
return _buildRow(context, _peers[i]);
360+
}),
369361
);
370362
}
371363
}

packages/flutter_webrtc/example/flutter_webrtc_demo/lib/src/call_sample/data_channel_sample.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
2525
RTCDataChannel? _dataChannel;
2626
Session? _session;
2727
Timer? _timer;
28-
var _text = '';
28+
String _text = '';
2929
bool _waitAccept = false;
3030

3131
@override
@@ -69,7 +69,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
6969
);
7070
}
7171

72-
Future<bool?> _showInvateDialog() {
72+
Future<bool?> _showInviteDialog() {
7373
return showDialog<bool?>(
7474
context: context,
7575
builder: (context) {
@@ -93,6 +93,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
9393
void _connect(BuildContext context) async {
9494
_signaling ??= Signaling(widget.host, context);
9595
await _signaling!.connect();
96+
9697
_signaling?.onDataChannelMessage = (_, dc, RTCDataChannelMessage data) {
9798
setState(() {
9899
if (data.isBinary) {
@@ -140,7 +141,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
140141
break;
141142
case CallState.CallStateInvite:
142143
_waitAccept = true;
143-
await _showInvateDialog();
144+
await _showInviteDialog();
144145
break;
145146
case CallState.CallStateConnected:
146147
if (_waitAccept) {
@@ -203,7 +204,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
203204
_signaling?.bye(_session!.sid);
204205
}
205206

206-
ListBody _buildRow(context, peer) {
207+
Widget _buildRow(context, peer) {
207208
var self = peer['id'] == _selfId;
208209
return ListBody(children: <Widget>[
209210
ListTile(
@@ -242,7 +243,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
242243
body: _inCalling
243244
? Center(
244245
child: Container(
245-
child: Text('Recevied => $_text'),
246+
child: Text('Received => $_text'),
246247
),
247248
)
248249
: ListView.builder(

0 commit comments

Comments
 (0)