File tree Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -150,17 +150,16 @@ class ObsSwitcher extends _events.default {
150
150
var publish = result . rtmp . server [ 0 ] . application . find ( stream => {
151
151
return stream . name [ 0 ] === application ;
152
152
} ) . live [ 0 ] . stream ;
153
+ var stream = publish . find ( stream => {
154
+ return stream . name [ 0 ] === key ;
155
+ } ) ;
153
156
154
- if ( publish == null ) {
155
- _this2 . nginxVideoMeta = null ;
156
- _this2 . bitrate = null ;
157
- } else {
158
- var stream = publish . find ( stream => {
159
- return stream . name [ 0 ] === key ;
160
- } ) ;
161
- if ( stream == null ) return ;
157
+ if ( stream != null ) {
162
158
_this2 . nginxVideoMeta = stream . meta [ 0 ] . video [ 0 ] ;
163
159
_this2 . bitrate = Math . round ( stream . bw_video [ 0 ] / 1024 ) ;
160
+ } else {
161
+ _this2 . nginxVideoMeta = null ;
162
+ _this2 . bitrate = null ;
164
163
}
165
164
} ) ;
166
165
} catch ( e ) {
Original file line number Diff line number Diff line change @@ -210,21 +210,19 @@ class ObsSwitcher extends EventEmitter {
210
210
}
211
211
) . live [ 0 ] . stream ;
212
212
213
- if ( publish == null ) {
214
- this . nginxVideoMeta = null ;
215
- this . bitrate = null ;
216
- } else {
217
- const stream = publish . find ( ( stream ) => {
218
- return stream . name [ 0 ] === key ;
219
- } ) ;
220
-
221
- if ( stream == null ) return ;
213
+ const stream = publish . find ( ( stream ) => {
214
+ return stream . name [ 0 ] === key ;
215
+ } ) ;
222
216
217
+ if ( stream != null ) {
223
218
this . nginxVideoMeta = stream . meta [ 0 ] . video [ 0 ] ;
224
219
this . bitrate = Math . round (
225
- stream . bw_video [ 0 ] / 1024
226
- ) ;
227
- }
220
+ stream . bw_video [ 0 ] / 1024
221
+ ) ;
222
+ } else {
223
+ this . nginxVideoMeta = null ;
224
+ this . bitrate = null ;
225
+ }
228
226
} ) ;
229
227
} catch ( e ) {
230
228
log . error ( "[NGINX] Error fetching stats" ) ;
You can’t perform that action at this time.
0 commit comments