8000 Update README.md · radiocom/flutter-webrtc@9488f87 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9488f87

Browse files
authored
Update README.md
1 parent 396af85 commit 9488f87

File tree

1 file changed

+4
-109
lines changed

1 file changed

+4
-109
lines changed

README.md

Lines changed: 4 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -57,114 +57,9 @@ We intend to implement support the following features:
5757
- [ ] MediaRecorder
5858
- [ ] Flutter Web
5959

60-
### Example
61-
62-
```dart
63-
import 'package:flutter/material.dart';
64-
import 'package:flutter_webrtc/webrtc.dart';
65-
import 'dart:core';
66-
67-
/**
68-
* getUserMedia sample
69-
*/
70-
class GetUserMediaSample extends StatefulWidget {
71-
static String tag = 'get_usermedia_sample';
72-
73-
@override
74-
_GetUserMediaSampleState createState() => new _GetUserMediaSampleState();
75-
}
76-
77-
class _GetUserMediaSampleState extends State<GetUserMediaSample> {
78-
MediaStream _localStream;
79-
final _localRenderer = new RTCVideoRenderer();
80-
bool _inCalling = false;
81-
82-
@override
83-
initState() {
84-
super.initState();
85-
initRenderers();
86-
}
87-
88-
@override
89-
deactivate() {
90-
super.deactivate();
91-
if (_inCalling) {
92-
_hangUp();
93-
}
94-
}
95-
96-
initRenderers() async {
97-
await _localRenderer.initialize();
98-
}
99-
100-
// Platform messages are asynchronous, so we initialize in an async method.
101-
_makeCall() async {
102-
final Map<String, dynamic> mediaConstraints = {
103-
"audio": true,
104-
"video": {
105-
"mandatory": {
106-
"minWidth":'640', // Provide your own width, height and frame rate here
107-
"minHeight": '480',
108-
"minFrameRate": '30',
109-
},
110-
"facingMode": "user",
111-
"optional": [],
112-
}
113-
};
114-
115-
try {
116-
var stream = await navigator.getUserMedia(mediaConstraints);
117-
_localStream = stream;
118-
_localRenderer.srcObject = _localStream;
119-
} catch (e) {
120-
print(e.toString());
121-
}
122-
if (!mounted) return;
123-
124-
setState(() {
125-
_inCalling = true;
126-
});
127-
}
128-
129-
_hangUp() async {
130-
try {
131-
await _localStream.dispose();
132-
_localRenderer.srcObject = null;
133-
} catch (e) {
134-
print(e.toString());
135-
}
136-
setState(() {
137-
_inCalling = false;
138-
});
139-
}
140-
141-
@override
142-
Widget build(BuildContext context) {
143-
return new Scaffold(
144-
appBar: new AppBar(
145-
title: new Text('GetUserMedia API Test'),
146-
),
147-
body: new OrientationBuilder(
148-
builder: (context, orientation) {
149-
return new Center(
150-
child: new Container(
151-
margin: new EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
152-
width: MediaQuery.of(context).size.width,
153-
height: MediaQuery.of(context).size.height,
154-
child: RTCVideoView(_localRenderer),
155-
decoration: new BoxDecoration(color: Colors.black54),
156-
),
157-
);
158-
},
159-
),
160-
floatingActionButton: new FloatingActionButton(
161-
onPressed: _inCalling ? _hangUp : _makeCall,
162-
tooltip: _inCalling ? 'Hangup' : 'Call',
163-
child: new Icon(_inCalling ? Icons.call_end : Icons.phone),
164-
),
165-
);
166-
}
167-
}
168-
```
60+
## Contributing
61+
The project is inseparable from the contributors of the community.
62+
- [CloudWebRTC](https://github.com/cloudwebrtc) - Original Author
16963

64+
### Example
17065
For more examples, please refer to [flutter-webrtc-demo](https://github.com/cloudwebrtc/flutter-webrtc-demo/).

0 commit comments

Comments
 (0)
0