@@ -11,7 +11,7 @@ class LiveStreamScreen extends StatefulWidget {
11
11
}
12
12
13
13
class _LiveStreamScreenState extends State <LiveStreamScreen > {
14
- final callId = "REPLACE_WITH_CALL_ID " ;
14
+ final callId = "demo12345 " ;
15
15
Call ? _livestreamCall;
16
16
17
17
@override
@@ -42,36 +42,39 @@ class _LiveStreamScreenState extends State<LiveStreamScreen> {
42
42
);
43
43
}
44
44
45
- return SafeArea (
46
- child: StreamBuilder (
47
- stream: _livestreamCall! .state.valueStream,
48
- initialData: _livestreamCall! .state.value,
49
- builder: (context, snapshot) {
50
- final callState = snapshot.data! ;
51
- final participant = callState.callParticipants.firstOrNull;
52
- return Scaffold (
53
- appBar: AppBar (
54
- actions: [
55
- OutlinedButton (
45
+ return StreamBuilder (
46
+ stream: _livestreamCall! .state.valueStream,
47
+ initialData: _livestreamCall! .state.value,
48
+ builder: (context, snapshot) {
49
+ final callState = snapshot.data! ;
50
+ final participant = callState.callParticipants.firstOrNull;
51
+ return Scaffold (
52
+ appBar: AppBar (
53
+ actions: [
54
+ Padding (
55
+ padding: const EdgeInsets .symmetric (horizontal: 8.0 ),
56
+ child: OutlinedButton (
56
57
onPressed: () {
57
58
_livestreamCall! .end ();
58
59
Navigator .pop (context);
59
60
},
60
61
child: const Text ('End Call' ),
61
62
),
62
- ],
63
- title: Text ('Viewers: ${callState .callParticipants .length }' ),
64
- automaticallyImplyLeading: false ,
65
- ),
66
- body: Builder (
67
- builder: (context) {
68
- if (! snapshot.hasData) {
69
- return const Center (
70
- child: CircularProgressIndicator (),
71
- );
72
- } else {
73
- if (snapshot.hasData && callState.isBackstage) {
74
- return Column (
63
+ ),
64
+ ],
65
+ title: Text ('Viewers: ${callState .callParticipants .length }' ),
66
+ automaticallyImplyLeading: false ,
67
+ ),
68
+ body: Builder (
69
+ builder: (context) {
70
+ if (! snapshot.hasData) {
71
+ return const Center (
72
+ child: CircularProgressIndicator (),
73
+ );
74
+ } else {
75
+ if (snapshot.hasData && callState.isBackstage) {
76
+ return Center (
77
+ child: Column (
75
78
mainAxisAlignment: MainAxisAlignment .center,
76
79
children: [
77
80
const Text ('Stream not live' ),
@@ -82,20 +85,20 @@ class _LiveStreamScreenState extends State<LiveStreamScreen> {
82
85
child: const Text ('Go Live' ),
83
86
),
84
87
],
85
- );
86
- }
87
-
88
- return StreamVideoRenderer (
89
- call: _livestreamCall! ,
90
- videoTrackType: SfuTrackType .video,
91
- participant: participant! ,
88
+ ),
92
89
);
93
90
}
94
- },
95
- ),
96
- );
97
- },
98
- ),
91
+
92
+ return StreamVideoRenderer (
93
+ call: _livestreamCall! ,
94
+ videoTrackType: SfuTrackType .video,
95
+ participant: participant! ,
96
+ );
97
+ }
98
+ },
99
+ ),
100
+ );
101
+ },
99
102
);
100
103
}
101
104
}
0 commit comments