8000 Improve examples. · next-coder/flutter-webrtc@b3f81e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit b3f81e3

Browse files
committed
Improve examples.
1 parent a38c858 commit b3f81e3

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

example/lib/src/get_display_media_sample.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class _GetDisplayMediaSampleState extends State<GetDisplayMediaSample> {
5252
final mediaConstraints = <String, dynamic>{'audio': true, 'video': true};
5353

5454
try {
55-
var stream = await navigator.mediaDevices.getDisplayMedia(mediaConstraints);
55+
var stream =
56+
await navigator.mediaDevices.getDisplayMedia(mediaConstraints);
5657
stream.getVideoTracks()[0].onEnded = () {
5758
print(
5859
'By adding a listener on onEnded you can: 1) catch stop video sharing on Web');
@@ -108,8 +109,8 @@ class _GetDisplayMediaSampleState extends State<GetDisplayMediaSample> {
108109
margin: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
109110
width: MediaQuery.of(context).size.width,
110111
height: MediaQuery.of(context).size.height,
111-
child: RTCVideoView(_localRenderer),
112112
decoration: BoxDecoration(color: Colors.black54),
113+
child: RTCVideoView(_localRenderer),
113114
)
114115
]),
115116
);

example/lib/src/get_user_media_sample.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ class _GetUserMediaSampleState extends State<GetUserMediaSample> {
212212
margin: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
213213
width: MediaQuery.of(context).size.width,
214214
height: MediaQuery.of(context).size.height,
215-
child: RTCVideoView(_localRenderer, mirror: true),
216215
decoration: BoxDecoration(color: Colors.black54),
216+
child: RTCVideoView(_localRenderer, mirror: true),
217217
),
218218
);
219219
},

example/lib/src/get_user_media_sample_web.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class _GetUserMediaSampleState extends State<GetUserMediaSample> {
109109
_mediaRecorder = null;
110110
});
111111
print(objectUrl);
112+
// ignore: unsafe_html
112113
html.window.open(objectUrl, '_blank');
113114
}
114115

@@ -124,8 +125,8 @@ class _GetUserMediaSampleState extends State<GetUserMediaSample> {
124125
content: Image.network(frame, height: 720, width: 1280),
125126
actions: <Widget>[
126127
TextButton(
127-
child: Text('OK'),
128128
onPressed: Navigator.of(context, rootNavigator: true).pop,
129+
child: Text('OK'),
129130
)
130131
],
131132
));
@@ -175,8 +176,8 @@ class _GetUserMediaSampleState extends State<GetUserMediaSample> {
175176
margin: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
176177
width: MediaQuery.of(context).size.width,
177178
height: MediaQuery.of(context).size.height,
178-
child: RTCVideoView(_localRenderer, mirror: true),
179179
decoration: BoxDecoration(color: Colors.black54),
180+
child: RTCVideoView(_localRenderer, mirror: true),
180181
),
181182
);
182183
},

example/lib/src/loopback_sample.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ class _MyAppState extends State<LoopBackSample> {
106106

107107
void _onTrack(RTCTrackEvent event) {
108108
print('onTrack');
109+
if (event.track.kind == 'video') {
110+
_remoteRenderer.srcObject = event.streams[0];
111+
}
109112
}
110113

111114
void _onAddTrack(MediaStream stream, MediaStreamTrack track) {

0 commit comments

Comments
 (0)
0