Skip to content

Commit

Permalink
Merge branch 'master' into videohole_set_cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
hyue7 authored Nov 22, 2023
2 parents 9725753 + d6768f5 commit 396d4ab
Show file tree
Hide file tree
Showing 36 changed files with 1,142 additions and 824 deletions.
6 changes: 5 additions & 1 deletion packages/flutter_webrtc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## NEXT
## 0.1.3

* Increase the minimum Flutter version to 3.3.
* Update libwebrtc to m114 version.
* Update flutter_webrtc to 0.9.46.
* Update and format flutter_webrtc_demo.
* Support the empty candidate for 'addIceCandidate' api.

## 0.1.2

Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_webrtc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ For other Tizen devices :

```yaml
dependencies:
flutter_webrtc: ^0.9.28
flutter_webrtc_tizen: ^0.1.2
flutter_webrtc: ^0.9.46
flutter_webrtc_tizen: ^0.1.3
```
## Functionality
Expand Down
14 changes: 5 additions & 9 deletions packages/flutter_webrtc/example/flutter_webrtc_demo/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# flutter-webrtc-demo

[![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)

Flutter WebRTC plugin Demo

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

## Usage

- `cd flutter_webrtc_demo`
- `flutter-tizen pub get`
- `flutter-tizen run`

## Note

- 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.

## screenshots

### iOS

# iOS
<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"/>

### Android

# Android
<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"/>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,3 @@ analyzer:
# allow self-reference to deprecated members (we do this because otherwise we have
# to annotate every member in every test, assert, etc, when we deprecate something)
deprecated_member_use_from_same_package: ignore
# Ignore analyzer hints for updating pubspecs when using Future or
# Stream and not importing dart:async
# Please see https://github.com/flutter/flutter/pull/24528 for details.
sdk_version_async_exported_from_core: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class _MyAppState extends State<MyApp> {
_initItems();
}

ListBody _buildRow(context, item) {
Widget _buildRow(context, item) {
return ListBody(children: <Widget>[
ListTile(
title: Text(item.title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class _CallSampleState extends State<CallSample> {
final RTCVideoRenderer _remoteRenderer = RTCVideoRenderer();
bool _inCalling = false;
Session? _session;

bool _waitAccept = false;

@override
Expand All @@ -42,6 +41,9 @@ class _CallSampleState extends State<CallSample> {
@override
void deactivate() {
super.deactivate();
if (_inCalling) {
_hangUp();
}
_signaling?.close();
_localRenderer.dispose();
_remoteRenderer.dispose();
Expand Down Expand Up @@ -92,7 +94,7 @@ class _CallSampleState extends State<CallSample> {
break;
case CallState.CallStateInvite:
_waitAccept = true;
await _showInvateDialog();
await _showInviteDialog();
break;
case CallState.CallStateConnected:
if (_waitAccept) {
Expand Down Expand Up @@ -156,7 +158,7 @@ class _CallSampleState extends State<CallSample> {
);
}

Future<bool?> _showInvateDialog() {
Future<bool?> _showInviteDialog() {
return showDialog<bool?>(
context: context,
builder: (context) {
Expand Down Expand Up @@ -276,96 +278,86 @@ class _CallSampleState extends State<CallSample> {
]);
}

Future<bool> _onWillPop(BuildContext context) async {
if (_inCalling) {
_hangUp();
}
return true;
}

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () => _onWillPop(context),
child: Scaffold(
appBar: AppBar(
title: Text(
'P2P Call Sample${_selfId != null ? ' [Your ID ($_selfId)] ' : ''}'),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.settings),
onPressed: null,
tooltip: 'setup',
),
],
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: _inCalling
? SizedBox(
width: 240.0,
return Scaffold(
appBar: AppBar(
title: Text(
'P2P Call Sample${_selfId != null ? ' [Your ID ($_selfId)] ' : ''}'),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.settings),
onPressed: null,
tooltip: 'setup',
),
],
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: _inCalling
? SizedBox(
width: 240.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FloatingActionButton(
tooltip: 'Camera',
onPressed: _switchCamera,
child: const Icon(Icons.switch_camera),
),
FloatingActionButton(
tooltip: 'Screen Sharing',
onPressed: () => selectScreenSourceDialog(context),
child: const Icon(Icons.desktop_mac),
),
FloatingActionButton(
onPressed: _hangUp,
tooltip: 'Hangup',
backgroundColor: Colors.pink,
child: Icon(Icons.call_end),
),
FloatingActionButton(
tooltip: 'Mute Mic',
onPressed: _muteMic,
child: const Icon(Icons.mic_off),
)
]))
: null,
body: _inCalling
? OrientationBuilder(builder: (context, orientation) {
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FloatingActionButton(
tooltip: 'Camera',
onPressed: _switchCamera,
child: const Icon(Icons.switch_camera),
),
FloatingActionButton(
tooltip: 'Screen Sharing',
onPressed: () => selectScreenSourceDialog(context),
child: const Icon(Icons.desktop_mac),
children: <Widget>[
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(color: Colors.black54),
child: RTCVideoView(_localRenderer),
),
FloatingActionButton(
onPressed: _hangUp,
tooltip: 'Hangup',
backgroundColor: Colors.pink,
child: Icon(Icons.call_end),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(color: Colors.black54),
child: RTCVideoView(_remoteRenderer),
),
FloatingActionButton(
tooltip: 'Mute Mic',
onPressed: _muteMic,
child: const Icon(Icons.mic_off),
)
]))
: null,
body: _inCalling
? OrientationBuilder(builder: (context, orientation) {
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(color: Colors.black54),
child: RTCVideoView(_localRenderer),
),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(color: Colors.black54),
child: RTCVideoView(_remoteRenderer),
),
),
],
),
);
})
: ListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.all(0.0),
itemCount: _peers.length,
itemBuilder: (context, i) {
return _buildRow(context, _peers[i]);
}),
),
),
],
),
);
})
: ListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.all(0.0),
itemCount: _peers.length,
itemBuilder: (context, i) {
return _buildRow(context, _peers[i]);
}),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
RTCDataChannel? _dataChannel;
Session? _session;
Timer? _timer;
var _text = '';
String _text = '';
bool _waitAccept = false;

@override
Expand Down Expand Up @@ -69,7 +69,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
);
}

Future<bool?> _showInvateDialog() {
Future<bool?> _showInviteDialog() {
return showDialog<bool?>(
context: context,
builder: (context) {
Expand All @@ -93,6 +93,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
void _connect(BuildContext context) async {
_signaling ??= Signaling(widget.host, context);
await _signaling!.connect();

_signaling?.onDataChannelMessage = (_, dc, RTCDataChannelMessage data) {
setState(() {
if (data.isBinary) {
Expand Down Expand Up @@ -140,7 +141,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
break;
case CallState.CallStateInvite:
_waitAccept = true;
await _showInvateDialog();
await _showInviteDialog();
break;
case CallState.CallStateConnected:
if (_waitAccept) {
Expand Down Expand Up @@ -203,7 +204,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
_signaling?.bye(_session!.sid);
}

ListBody _buildRow(context, peer) {
Widget _buildRow(context, peer) {
var self = peer['id'] == _selfId;
return ListBody(children: <Widget>[
ListTile(
Expand Down Expand Up @@ -242,7 +243,7 @@ class _DataChannelSampleState extends State<DataChannelSample> {
body: _inCalling
? Center(
child: Container(
child: Text('Recevied => $_text'),
child: Text('Received => $_text'),
),
)
: ListView.builder(
Expand Down
Loading

0 comments on commit 396d4ab

Please sign in to comment.