File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -70,23 +70,19 @@ function ThroughputController() {
7070 function _registerEvents ( ) {
7171 eventBus . on ( MediaPlayerEvents . METRIC_ADDED , _onMetricAdded , instance ) ;
7272
73- if ( performance ) {
74- performance . addEventListener (
75- 'resourcetimingbufferfull' ,
76- _onResourceTimingBufferFull ,
77- ) ;
78- }
73+ window . performance ?. addEventListener ?. (
74+ 'resourcetimingbufferfull' ,
75+ _onResourceTimingBufferFull ,
76+ ) ;
7977 }
8078
8179 function _resetEvents ( ) {
8280 eventBus . off ( MediaPlayerEvents . METRIC_ADDED , _onMetricAdded , instance ) ;
8381
84- if ( performance ) {
85- performance . removeEventListener (
86- 'resourcetimingbufferfull' ,
87- _onResourceTimingBufferFull ,
88- ) ;
89- }
82+ window . performance ?. removeEventListener ?. (
83+ 'resourcetimingbufferfull' ,
84+ _onResourceTimingBufferFull ,
85+ ) ;
9086 }
9187
9288 function _onResourceTimingBufferFull ( ) {
Original file line number Diff line number Diff line change @@ -501,7 +501,7 @@ function HTTPLoader(cfg) {
501501 }
502502
503503 // Get a list of "resource" performance entries
504- const resources = performance . getEntriesByType ( 'resource' ) ;
504+ const resources = performance . getEntriesByType ?. ( 'resource' ) ;
505505 if ( resources === undefined || resources . length <= 0 ) {
506506 return ;
507507 }
You can’t perform that action at this time.
0 commit comments