1
1
import { Screen , AddChildFromBuilder , Application , booleanConverter , ContentView , Utils } from '@nativescript/core' ;
2
- import { Property , CSSType } from '@nativescript/core/ui/core/view' ;
2
+ import { Property , CSSType } from '@nativescript/core/ui/core/view' ;
3
3
import { PercentLength } from '@nativescript/core/ui/styling/style-properties' ;
4
4
5
5
@CSSType ( 'Video' )
@@ -90,7 +90,7 @@ export abstract class VideoBase extends ContentView implements AddChildFromBuild
90
90
}
91
91
}
92
92
_removeListener ( type : string , listener : Function , listeners : any ) {
93
- if ( listener && typeof listeners === 'object' ) {
93
+ if ( listener && listeners && typeof listeners === 'object' ) {
94
94
const currentEvents = listeners [ type ] ;
95
95
if ( Array . isArray ( currentEvents ) ) {
96
96
const size = currentEvents . length ;
@@ -111,7 +111,7 @@ export abstract class VideoBase extends ContentView implements AddChildFromBuild
111
111
112
112
_listenerExist ( type : string , listener : Function , listeners : any ) : boolean {
113
113
let has = false ;
114
- if ( listener && typeof listeners === 'object' ) {
114
+ if ( listener && listeners && typeof listeners === 'object' ) {
115
115
const currentEvents = listeners [ type ] ;
116
116
if ( Array . isArray ( currentEvents ) ) {
117
117
const size = currentEvents . length ;
@@ -137,15 +137,15 @@ export abstract class VideoBase extends ContentView implements AddChildFromBuild
137
137
if ( isCapture ) {
138
138
if ( ! this . _listenerExist ( type , listener , this . _capturedListeners ) ) {
139
139
if ( Array . isArray ( this . _capturedListeners [ type ] ) ) {
140
- this . _capturedListeners [ type ] . push ( listener ) ;
140
+ this . _capturedListeners [ type ] ? .push ?. ( listener ) ;
141
141
} else {
142
142
this . _capturedListeners [ type ] = [ listener ] ;
143
143
}
144
144
}
145
145
} else {
146
146
if ( ! this . _listenerExist ( type , listener , this . _listeners ) ) {
147
147
if ( Array . isArray ( this . _listeners [ type ] ) ) {
148
- this . _listeners [ type ] . push ( listener ) ;
148
+ this . _listeners [ type ] ? .push ?. ( listener ) ;
149
149
} else {
150
150
this . _listeners [ type ] = [ listener ] ;
151
151
}
@@ -163,15 +163,15 @@ export abstract class VideoBase extends ContentView implements AddChildFromBuild
163
163
if ( isCapture ) {
164
164
if ( ! this . _listenerExist ( type , listener , this . _capturedListeners ) ) {
165
165
if ( Array . isArray ( this . _capturedListeners [ type ] ) ) {
166
- this . _capturedListeners [ type ] . push ( listener ) ;
166
+ this . _capturedListeners [ type ] ? .push ?. ( listener ) ;
167
167
} else {
168
168
this . _capturedListeners [ type ] = [ listener ] ;
169
169
}
170
170
}
171
171
} else {
172
172
if ( ! this . _listenerExist ( type , listener , this . _listeners ) ) {
173
173
if ( Array . isArray ( this . _listeners [ type ] ) ) {
174
- this . _listeners [ type ] . push ( listener ) ;
174
+ this . _listeners [ type ] ? .push ?. ( listener ) ;
175
175
} else {
176
176
this . _listeners [ type ] = [ listener ] ;
177
177
}
@@ -182,7 +182,7 @@ export abstract class VideoBase extends ContentView implements AddChildFromBuild
182
182
_videoFrameCallbacks : Function [ ] = [ ] ;
183
183
requestVideoFrameCallback ( callback : Function ) {
184
184
if ( typeof callback === 'function' ) {
185
- this . _videoFrameCallbacks . push ( callback ) ;
185
+ this . _videoFrameCallbacks ? .push ?. ( callback ) ;
186
186
}
187
187
}
188
188
_notifyVideoFrameCallbacks ( ) {
0 commit comments