File tree 3 files changed +12
-12
lines changed
web/src/components/player
3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ type JSMpegPlayerProps = {
14
14
containerRef : React . MutableRefObject < HTMLDivElement | null > ;
15
15
playbackEnabled : boolean ;
16
16
useWebGL : boolean ;
17
- setStats : ( stats : PlayerStatsType ) => void ;
17
+ setStats ? : ( stats : PlayerStatsType ) => void ;
18
18
onPlaying ?: ( ) => void ;
19
19
} ;
20
20
@@ -166,7 +166,7 @@ export default function JSMpegPlayer({
166
166
const timeDiff = ( currentTimestamp - lastTimestampRef . current ) / 1000 ; // in seconds
167
167
const bitrate = ( bytesReceivedRef . current * 8 ) / timeDiff / 1000 ; // in kbps
168
168
169
- setStats ( {
169
+ setStats ?. ( {
170
170
streamType : "jsmpeg" ,
171
171
bandwidth : Math . round ( bitrate ) ,
172
172
totalFrames : frameCount ,
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ type MSEPlayerProps = {
22
22
volume ?: number ;
23
23
playInBackground ?: boolean ;
24
24
pip ?: boolean ;
25
- getStats : boolean ;
26
- setStats : ( stats : PlayerStatsType ) => void ;
25
+ getStats ? : boolean ;
26
+ setStats ? : ( stats : PlayerStatsType ) => void ;
27
27
onPlaying ?: ( ) => void ;
28
28
setFullResolution ?: React . Dispatch < SetStateAction < VideoResolutionType > > ;
29
29
onError ?: ( error : LivePlayerError ) => void ;
@@ -37,7 +37,7 @@ function MSEPlayer({
37
37
volume,
38
38
playInBackground = false ,
39
39
pip = false ,
40
- getStats,
40
+ getStats = false ,
41
41
setStats,
42
42
onPlaying,
43
43
setFullResolution,
@@ -611,7 +611,7 @@ function MSEPlayer({
611
611
? ( droppedVideoFrames / totalVideoFrames ) * 100
612
612
: 0 ;
613
613
614
- setStats ( {
614
+ setStats ?. ( {
615
615
streamType : "MSE" ,
616
616
bandwidth,
617
617
latency,
@@ -627,7 +627,7 @@ function MSEPlayer({
627
627
628
628
return ( ) => {
629
629
clearInterval ( interval ) ;
630
- setStats ( {
630
+ setStats ?. ( {
631
631
streamType : "-" ,
632
632
bandwidth : 0 ,
633
633
latency : undefined ,
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ type WebRtcPlayerProps = {
11
11
microphoneEnabled ?: boolean ;
12
12
iOSCompatFullScreen ?: boolean ; // ios doesn't support fullscreen divs so we must support the video element
13
13
pip ?: boolean ;
14
- getStats : boolean ;
15
- setStats : ( stats : PlayerStatsType ) => void ;
14
+ getStats ? : boolean ;
15
+ setStats ? : ( stats : PlayerStatsType ) => void ;
16
16
onPlaying ?: ( ) => void ;
17
17
onError ?: ( error : LivePlayerError ) => void ;
18
18
} ;
@@ -26,7 +26,7 @@ export default function WebRtcPlayer({
26
26
microphoneEnabled = false ,
27
27
iOSCompatFullScreen = false ,
28
28
pip = false ,
29
- getStats,
29
+ getStats = false ,
30
30
setStats,
31
31
onPlaying,
32
32
onError,
@@ -268,7 +268,7 @@ export default function WebRtcPlayer({
268
268
? ( bytesReceived - lastBytesReceived ) / timeDiff / 1000
269
269
: 0 ; // in kbps
270
270
271
- setStats ( {
271
+ setStats ?. ( {
272
272
streamType : "WebRTC" ,
273
273
bandwidth : Math . round ( bitrate ) ,
274
274
latency : roundTripTime ,
@@ -286,7 +286,7 @@ export default function WebRtcPlayer({
286
286
287
287
return ( ) => {
288
288
clearInterval ( interval ) ;
289
- setStats ( {
289
+ setStats ?. ( {
290
290
streamType : "-" ,
291
291
bandwidth : 0 ,
292
292
latency : undefined ,
You can’t perform that action at this time.
0 commit comments