@@ -27,6 +27,8 @@ class _PlayState extends State<Play> {
27
27
final RTCVideoRenderer _remoteRenderer = RTCVideoRenderer ();
28
28
List <String > abrList = ['Automatic' ];
29
29
bool _inCalling = false ;
30
+ bool _isPaused = false ;
31
+ bool _isFullScreen = false ;
30
32
31
33
_PlayState ();
32
34
@@ -85,7 +87,8 @@ class _PlayState extends State<Play> {
85
87
_localRenderer.srcObject = null ;
86
88
_remoteRenderer.srcObject = null ;
87
89
_inCalling = false ;
88
- Navigator .pop (context);
90
+ _isPaused ? _isPaused : Navigator .pop (context);
91
+ // Navigator.pop(context);
89
92
});
90
93
break ;
91
94
case HelperState .ConnectionOpen :
@@ -172,8 +175,8 @@ class _PlayState extends State<Play> {
172
175
heroTag: "btn2" ,
173
176
onPressed: _hangUp,
174
177
tooltip: 'Hangup' ,
175
- child: const Icon (Icons .call_end),
176
178
backgroundColor: Colors .pink,
179
+ child: const Icon (Icons .call_end),
177
180
),
178
181
DropdownButton <String >(
179
182
items: abrList.map ((String value) {
@@ -190,21 +193,60 @@ class _PlayState extends State<Play> {
190
193
)
191
194
]))
192
195
: null ,
193
- body: OrientationBuilder (builder: (context, orientation) {
194
- return Stack (children: < Widget > [
195
- Positioned (
196
- left: 0.0 ,
197
- right: 0.0 ,
198
- top: 0.0 ,
199
- bottom: 0.0 ,
200
- child: Container (
196
+ body: OrientationBuilder (
197
+ builder: (context, orientation) {
198
+ return Stack (
199
+ children: < Widget > [
200
+ _isFullScreen ? Container (
201
+ margin: const EdgeInsets .fromLTRB (0.0 , 0.0 , 0.0 , 0.0 ),
202
+ width: MediaQuery .of (context).size.width,
203
+ height: MediaQuery .of (context).size.height,
204
+ decoration: const BoxDecoration (color: Colors .black54),
205
+ child: RTCVideoView (_remoteRenderer,objectFit: orientation == Orientation .portrait ? RTCVideoViewObjectFit .RTCVideoViewObjectFitContain : RTCVideoViewObjectFit .RTCVideoViewObjectFitCover ),
206
+ ) : Container (
201
207
margin: const EdgeInsets .fromLTRB (0.0 , 0.0 , 0.0 , 0.0 ),
202
208
width: MediaQuery .of (context).size.width,
203
209
height: MediaQuery .of (context).size.height,
204
- child: RTCVideoView (_remoteRenderer),
205
210
decoration: const BoxDecoration (color: Colors .black54),
206
- )),
207
- ]);
208
- }));
211
+ child: RTCVideoView (_remoteRenderer),
212
+ ),
213
+ _isPaused
214
+ ? Center (
215
+ child: FloatingActionButton (
216
+ heroTag: "btn3" ,
217
+ onPressed: () {
218
+ setState (() {
219
+ _isPaused = false ;
220
+ });
221
+ _connect ();
222
+ },
223
+ tooltip: 'Play' ,
224
+ backgroundColor: Colors .grey.withOpacity (0.6 ),
225
+ child: const Icon (Icons .play_arrow),
226
+ ),
227
+ )
228
+ : GestureDetector (
229
+ onTap: () {
230
+ setState (() {
231
+ _isPaused = true ;
232
+ });
233
+ _hangUp ();
234
+ },
235
+ child: Container (
236
+ color: Colors .transparent, // Makes the entire screen tappable
237
+ width: MediaQuery .of (context).size.width,
238
+ height: MediaQuery .of (context).size.height,
239
+ alignment: Alignment .center,
240
+ child: const Icon (
241
+ Icons .pause,
242
+ color: Colors .transparent, // Keeps the icon invisible
243
+ ),
244
+ ),
245
+ ),
246
+ ],
247
+ );
248
+ },
249
+ )
250
+ );
209
251
}
210
252
}
0 commit comments