@@ -104,6 +104,10 @@ MediaPlayer.dependencies.MetricsExtensions = function() {
104104 i = 0 ,
105105 adaptation ;
106106
107+ if ( ! manifest ) {
108+ return null ;
109+ }
110+
107111 for ( i = 0 ; i < manifest . Period . AdaptationSet . length ; i ++ ) {
108112 adaptation = manifest . Period . AdaptationSet [ i ] ;
109113 if ( adaptation . type === type ) {
@@ -120,6 +124,10 @@ MediaPlayer.dependencies.MetricsExtensions = function() {
120124 i = 0 ,
121125 adaptation ;
122126
127+ if ( ! manifest ) {
128+ return null ;
129+ }
130+
123131 for ( i = 0 ; i < manifest . Period . AdaptationSet . length ; i ++ ) {
124132 adaptation = manifest . Period . AdaptationSet [ i ] ;
125133 if ( adaptation . type === type || adaptation . contentType === type ) {
@@ -137,19 +145,16 @@ MediaPlayer.dependencies.MetricsExtensions = function() {
137145 representation ,
138146 periodArray ;
139147
140- if ( manifest ) {
141- periodArray = manifest . Period_asArray ;
142-
143- representation = findRepresentionInPeriodArray . call ( self , periodArray , representationId ) ;
144-
145- if ( representation === null ) {
146- return null ;
147- }
148+ if ( ! manifest ) {
149+ return null ;
150+ }
148151
149- return representation . width ;
150- } else {
152+ periodArray = manifest . Period_asArray ;
153+ representation = findRepresentionInPeriodArray . call ( self , periodArray , representationId ) ;
154+ if ( representation === null ) {
151155 return null ;
152156 }
157+ return representation . width ;
153158 } ;
154159
155160 rslt . getVideoHeightForRepresentation = function ( representationId ) {
@@ -158,19 +163,16 @@ MediaPlayer.dependencies.MetricsExtensions = function() {
158163 representation ,
159164 periodArray ;
160165
161- if ( manifest ) {
162- periodArray = manifest . Period_asArray ;
163-
164- representation = findRepresentionInPeriodArray . call ( self , periodArray , representationId ) ;
165-
166- if ( representation === null ) {
167- return null ;
168- }
166+ if ( ! manifest ) {
167+ return null ;
168+ }
169169
170- return representation . height ;
171- } else {
170+ periodArray = manifest . Period_asArray ;
171+ representation = findRepresentionInPeriodArray . call ( self , periodArray , representationId ) ;
172+ if ( representation === null ) {
172173 return null ;
173174 }
175+ return representation . height ;
174176 } ;
175177
176178 rslt . getCodecsForRepresentation = function ( representationId ) {
@@ -179,12 +181,14 @@ MediaPlayer.dependencies.MetricsExtensions = function() {
179181 representation ,
180182 periodArray = manifest . Period_asArray ;
181183
182- representation = findRepresentionInPeriodArray . call ( self , periodArray , representationId ) ;
184+ if ( ! manifest ) {
185+ return null ;
186+ }
183187
188+ representation = findRepresentionInPeriodArray . call ( self , periodArray , representationId ) ;
184189 if ( representation === null ) {
185190 return null ;
186191 }
187-
188192 return representation . codecs ;
189193 } ;
190194
@@ -213,7 +217,7 @@ MediaPlayer.dependencies.MetricsExtensions = function() {
213217 representationArrayIndex ,
214218 bitrateArray = [ ] ;
215219
216- if ( ( ( manifest === null ) || ( manifest === undefined ) ) && ( ( data === null ) || ( data === undefined ) ) ) {
220+ if ( ! manifest ) {
217221 return null ;
218222 }
219223
@@ -262,7 +266,7 @@ MediaPlayer.dependencies.MetricsExtensions = function() {
262266 representationArrayIndex ,
263267 bitrateArray = [ ] ;
264268
265- if ( ( manifest === null ) || ( manifest === undefined ) ) {
269+ if ( ! manifest ) {
266270 return null ;
267271 }
268272
0 commit comments