@fishjam-cloud/react-native-client 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +403 -0
- package/android/build.gradle +6 -6
- package/app.plugin.js +1 -1
- package/build/RNFishjamClientModule.d.ts +7 -5
- package/build/RNFishjamClientModule.d.ts.map +1 -1
- package/build/RNFishjamClientModule.js.map +1 -1
- package/build/common/client.d.ts +8 -1
- package/build/common/client.d.ts.map +1 -1
- package/build/common/client.js +9 -2
- package/build/common/client.js.map +1 -1
- package/build/components/VideoPreviewView.d.ts +3 -3
- package/build/components/VideoPreviewView.d.ts.map +1 -1
- package/build/components/VideoPreviewView.js +1 -1
- package/build/components/VideoPreviewView.js.map +1 -1
- package/build/hooks/useAudioSettings.d.ts.map +1 -1
- package/build/hooks/useAudioSettings.js +4 -5
- package/build/hooks/useAudioSettings.js.map +1 -1
- package/build/hooks/useBandwidthEstimation.d.ts +0 -3
- package/build/hooks/useBandwidthEstimation.d.ts.map +1 -1
- package/build/hooks/useBandwidthEstimation.js +3 -6
- package/build/hooks/useBandwidthEstimation.js.map +1 -1
- package/build/hooks/useCamera.d.ts +12 -21
- package/build/hooks/useCamera.d.ts.map +1 -1
- package/build/hooks/useCamera.js +52 -52
- package/build/hooks/useCamera.js.map +1 -1
- package/build/{common/eventEmitter.d.ts → hooks/useFishjamEvent.d.ts} +2 -3
- package/build/hooks/useFishjamEvent.d.ts.map +1 -0
- package/build/{common/eventEmitter.js → hooks/useFishjamEvent.js} +11 -2
- package/build/hooks/useFishjamEvent.js.map +1 -0
- package/build/hooks/useMicrophone.d.ts.map +1 -1
- package/build/hooks/useMicrophone.js +3 -7
- package/build/hooks/useMicrophone.js.map +1 -1
- package/build/hooks/useParticipants.d.ts +0 -3
- package/build/hooks/useParticipants.d.ts.map +1 -1
- package/build/hooks/useParticipants.js +6 -6
- package/build/hooks/useParticipants.js.map +1 -1
- package/build/hooks/useReconnection.d.ts.map +1 -1
- package/build/hooks/useReconnection.js +8 -18
- package/build/hooks/useReconnection.js.map +1 -1
- package/build/hooks/useScreencast.d.ts.map +1 -1
- package/build/hooks/useScreencast.js +3 -7
- package/build/hooks/useScreencast.js.map +1 -1
- package/build/index.d.ts +4 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/types.d.ts +25 -0
- package/build/types.d.ts.map +1 -1
- package/build/types.js +10 -1
- package/build/types.js.map +1 -1
- package/build/utils/foregroundService.d.ts +30 -0
- package/build/utils/foregroundService.d.ts.map +1 -0
- package/build/utils/foregroundService.js +41 -0
- package/build/utils/foregroundService.js.map +1 -0
- package/ios/RNFishjamClient.swift +37 -30
- package/ios/RNFishjamClientModule.swift +11 -7
- package/package.json +19 -19
- package/.eslintignore +0 -7
- package/.eslintrc +0 -6
- package/.prettierrc +0 -9
- package/.watchmanconfig +0 -1
- package/android/.editorconfig +0 -9
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/org/membraneframework/reactnative/AudioDeviceKind.kt +0 -34
- package/android/src/main/java/org/membraneframework/reactnative/AudioSwitchManager.kt +0 -61
- package/android/src/main/java/org/membraneframework/reactnative/EmitableEvents.kt +0 -14
- package/android/src/main/java/org/membraneframework/reactnative/Errors.kt +0 -31
- package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClient.kt +0 -866
- package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClientModule.kt +0 -294
- package/android/src/main/java/org/membraneframework/reactnative/Utils.kt +0 -11
- package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewView.kt +0 -40
- package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewViewModule.kt +0 -17
- package/android/src/main/java/org/membraneframework/reactnative/VideoRendererView.kt +0 -58
- package/android/src/main/java/org/membraneframework/reactnative/VideoRendererViewModule.kt +0 -25
- package/android/src/main/java/org/membraneframework/reactnative/VideoView.kt +0 -77
- package/babel.config.js +0 -2
- package/build/common/eventEmitter.d.ts.map +0 -1
- package/build/common/eventEmitter.js.map +0 -1
- package/expo-module.config.json +0 -17
- package/ios/RNFishjamClient.podspec +0 -30
- package/ios/swift-format-config.json +0 -56
- package/plugin/broadcastExtensionFiles/Info.plist +0 -27
- package/plugin/broadcastExtensionFiles/MembraneBroadcastSampleHandler.swift +0 -50
- package/plugin/broadcastExtensionFiles/MembraneScreenBroadcastExtension.entitlements +0 -10
- package/plugin/src/withMembrane.ts +0 -310
- package/plugin/tsconfig.json +0 -9
- package/scripts/lint.sh +0 -18
- package/scripts/lint_check.sh +0 -14
- package/src/RNFishjamClientModule.ts +0 -73
- package/src/__tests__/index.test.tsx +0 -199
- package/src/common/client.ts +0 -33
- package/src/common/eventEmitter.ts +0 -21
- package/src/common/metadata.ts +0 -12
- package/src/common/webRTC.ts +0 -31
- package/src/components/VideoPreviewView.tsx +0 -33
- package/src/components/VideoRendererView.tsx +0 -31
- package/src/hooks/useAudioSettings.ts +0 -115
- package/src/hooks/useBandwidthEstimation.ts +0 -24
- package/src/hooks/useCamera.ts +0 -270
- package/src/hooks/useMicrophone.ts +0 -38
- package/src/hooks/useParticipants.ts +0 -118
- package/src/hooks/useReconnection.ts +0 -41
- package/src/hooks/useScreencast.ts +0 -146
- package/src/index.tsx +0 -63
- package/src/protos/fishjam/peer_notifications.ts +0 -299
- package/src/stats/types.ts +0 -56
- package/src/stats/useRTCStatistics.ts +0 -97
- package/src/types.ts +0 -49
- package/tsconfig.json +0 -9
- package/typedoc.json +0 -5
package/src/stats/types.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A record of the total time, in seconds,
|
|
3
|
-
* that this stream has spent in each quality limitation state.
|
|
4
|
-
* none: The resolution and/or framerate is not limited.
|
|
5
|
-
* bandwidth: The resolution and/or framerate is primarily limited due to
|
|
6
|
-
* congestion cues during bandwidth estimation.
|
|
7
|
-
* Typical, congestion control algorithms use inter-arrival time,
|
|
8
|
-
* round-trip time, packet or other congestion cues to perform bandwidth estimation.
|
|
9
|
-
* cpu: The resolution and/or framerate is primarily limited due to CPU load.
|
|
10
|
-
* other: The resolution and/or framerate is primarily limited
|
|
11
|
-
* for a reason other than the above.
|
|
12
|
-
*/
|
|
13
|
-
export type QualityLimitationDurations = {
|
|
14
|
-
bandwidth: number;
|
|
15
|
-
cpu: number;
|
|
16
|
-
none: number;
|
|
17
|
-
other: number;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type RTCOutboundStats = {
|
|
21
|
-
'kind': string;
|
|
22
|
-
'rid': string;
|
|
23
|
-
'bytesSent': number;
|
|
24
|
-
'targetBitrate': number;
|
|
25
|
-
'packetsSent': number;
|
|
26
|
-
'framesEncoded': number;
|
|
27
|
-
'framesPerSecond': number;
|
|
28
|
-
'frameWidth': number;
|
|
29
|
-
'frameHeight': number;
|
|
30
|
-
'qualityLimitationDurations': QualityLimitationDurations;
|
|
31
|
-
'bytesSent/s': number;
|
|
32
|
-
'packetsSent/s': number;
|
|
33
|
-
'framesEncoded/s': number;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type RTCInboundStats = {
|
|
37
|
-
'kind': number;
|
|
38
|
-
'jitter': number;
|
|
39
|
-
'packetsLost': number;
|
|
40
|
-
'packetsReceived': number;
|
|
41
|
-
'bytesReceived': number;
|
|
42
|
-
'framesReceived': number;
|
|
43
|
-
'frameWidth': number;
|
|
44
|
-
'frameHeight': number;
|
|
45
|
-
'framesPerSecond': number;
|
|
46
|
-
'framesDropped': number;
|
|
47
|
-
'packetsLost/s': number;
|
|
48
|
-
'packetsReceived/s': number;
|
|
49
|
-
'bytesReceived/s': number;
|
|
50
|
-
'framesReceived/s': number;
|
|
51
|
-
'framesDropped/s': number;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export type RTCTrackStats = RTCOutboundStats | RTCInboundStats;
|
|
55
|
-
|
|
56
|
-
export type RTCStats = { [key: string]: RTCTrackStats };
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { takeRight } from 'lodash';
|
|
2
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import type { RTCInboundStats, RTCOutboundStats, RTCStats } from './types';
|
|
5
|
-
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This hook provides access to current rtc statistics data.
|
|
9
|
-
*/
|
|
10
|
-
export function useRTCStatistics(refreshInterval: number) {
|
|
11
|
-
const MAX_SIZE = 120;
|
|
12
|
-
const [statistics, setStatistics] = useState<RTCStats[]>([]);
|
|
13
|
-
|
|
14
|
-
// Calculates diff between pervious and current stats,
|
|
15
|
-
// providing end users with a per second metric.
|
|
16
|
-
const processIncomingStats = useCallback(
|
|
17
|
-
(statistics: ReadonlyArray<RTCStats>, stats: Readonly<RTCStats>) => {
|
|
18
|
-
Object.keys(stats).forEach((obj) => {
|
|
19
|
-
if (obj.includes('Inbound')) {
|
|
20
|
-
const rtcStats = stats[obj] as RTCInboundStats;
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
statistics.length > 0 &&
|
|
24
|
-
Object.keys(statistics[statistics.length - 1]).includes(obj)
|
|
25
|
-
) {
|
|
26
|
-
const prevRtcStats = statistics[statistics.length - 1][
|
|
27
|
-
obj
|
|
28
|
-
] as RTCInboundStats;
|
|
29
|
-
|
|
30
|
-
rtcStats['packetsLost/s'] =
|
|
31
|
-
rtcStats['packetsLost'] - prevRtcStats['packetsLost'];
|
|
32
|
-
rtcStats['packetsReceived/s'] =
|
|
33
|
-
rtcStats['packetsReceived'] - prevRtcStats['packetsReceived'];
|
|
34
|
-
rtcStats['bytesReceived/s'] =
|
|
35
|
-
rtcStats['bytesReceived'] - prevRtcStats['bytesReceived'];
|
|
36
|
-
rtcStats['framesReceived/s'] =
|
|
37
|
-
rtcStats['framesReceived'] - prevRtcStats['framesReceived'];
|
|
38
|
-
rtcStats['framesDropped/s'] =
|
|
39
|
-
rtcStats['framesDropped'] - prevRtcStats['framesDropped'];
|
|
40
|
-
} else {
|
|
41
|
-
rtcStats['packetsLost/s'] = 0;
|
|
42
|
-
rtcStats['packetsReceived/s'] = 0;
|
|
43
|
-
rtcStats['bytesReceived/s'] = 0;
|
|
44
|
-
rtcStats['framesReceived/s'] = 0;
|
|
45
|
-
rtcStats['framesDropped/s'] = 0;
|
|
46
|
-
}
|
|
47
|
-
return stats;
|
|
48
|
-
}
|
|
49
|
-
// Outbound
|
|
50
|
-
const rtcStats = stats[obj] as RTCOutboundStats;
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
statistics.length > 0 &&
|
|
54
|
-
Object.keys(statistics[statistics.length - 1]).includes(obj)
|
|
55
|
-
) {
|
|
56
|
-
const prevRtcStats = statistics[statistics.length - 1][
|
|
57
|
-
obj
|
|
58
|
-
] as RTCOutboundStats;
|
|
59
|
-
|
|
60
|
-
rtcStats['bytesSent/s'] =
|
|
61
|
-
rtcStats['bytesSent'] - prevRtcStats['bytesSent'];
|
|
62
|
-
rtcStats['packetsSent/s'] =
|
|
63
|
-
rtcStats['packetsSent'] - prevRtcStats['packetsSent'];
|
|
64
|
-
rtcStats['framesEncoded/s'] =
|
|
65
|
-
rtcStats['framesEncoded'] - prevRtcStats['framesEncoded'];
|
|
66
|
-
} else {
|
|
67
|
-
rtcStats['bytesSent/s'] = 0;
|
|
68
|
-
rtcStats['packetsSent/s'] = 0;
|
|
69
|
-
rtcStats['framesEncoded/s'] = 0;
|
|
70
|
-
}
|
|
71
|
-
return stats;
|
|
72
|
-
});
|
|
73
|
-
return stats;
|
|
74
|
-
},
|
|
75
|
-
[],
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
// Gets stats from the native libraries.
|
|
79
|
-
const getStatistics = useCallback(async () => {
|
|
80
|
-
const stats = await RNFishjamClientModule.getStatistics();
|
|
81
|
-
setStatistics((prev) => {
|
|
82
|
-
const newStats = [...prev, processIncomingStats(prev, stats)];
|
|
83
|
-
takeRight(newStats, MAX_SIZE);
|
|
84
|
-
return newStats;
|
|
85
|
-
});
|
|
86
|
-
}, [processIncomingStats]);
|
|
87
|
-
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
const intervalId = setInterval(getStatistics, refreshInterval);
|
|
90
|
-
return () => {
|
|
91
|
-
clearInterval(intervalId);
|
|
92
|
-
setStatistics([]);
|
|
93
|
-
};
|
|
94
|
-
}, [getStatistics, refreshInterval]);
|
|
95
|
-
|
|
96
|
-
return { statistics };
|
|
97
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// global
|
|
2
|
-
export type VideoLayout = 'FILL' | 'FIT';
|
|
3
|
-
|
|
4
|
-
export type TrackEncoding = 'l' | 'm' | 'h';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A type describing simulcast configuration.
|
|
8
|
-
*
|
|
9
|
-
* At the moment, simulcast track is initialized in three versions - low, medium and high.
|
|
10
|
-
* High resolution is the original track resolution, while medium and low resolutions are
|
|
11
|
-
* the original track resolution scaled down by 2 and 4 respectively.
|
|
12
|
-
*/
|
|
13
|
-
export type SimulcastConfig = {
|
|
14
|
-
/**
|
|
15
|
-
* whether to simulcast track or not. By default simulcast is disabled.
|
|
16
|
-
*/
|
|
17
|
-
enabled: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* list of active encodings. Encoding can be one of `"h"` (original encoding), `"m"` (scaled down x2), `"l"` (scaled down x4).
|
|
20
|
-
*/
|
|
21
|
-
activeEncodings: TrackEncoding[];
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Type describing maximal bandwidth that can be used, in kbps. 0 is interpreted as unlimited bandwidth.
|
|
26
|
-
*/
|
|
27
|
-
export type BandwidthLimit = number;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Type describing bandwidth limit for simulcast track. It is a mapping `encoding -> BandwidthLimit`. If encoding isn't present in this mapping,
|
|
31
|
-
* it will be assumed that this particular encoding shouldn't have any bandwidth limit.
|
|
32
|
-
*/
|
|
33
|
-
export type SimulcastBandwidthLimit = Record<TrackEncoding, BandwidthLimit>;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A type describing bandwidth limitation of a track, including simulcast and non-simulcast tracks. Can be `BandwidthLimit` or `SimulcastBandwidthLimit`.
|
|
37
|
-
*/
|
|
38
|
-
export type TrackBandwidthLimit = BandwidthLimit | SimulcastBandwidthLimit;
|
|
39
|
-
|
|
40
|
-
export type TrackMetadata = {
|
|
41
|
-
active: boolean;
|
|
42
|
-
type: 'audio' | 'camera' | 'screensharing';
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type GenericMetadata = Record<string, unknown>;
|
|
46
|
-
|
|
47
|
-
// branded types are useful for restricting where given value can be passed
|
|
48
|
-
declare const brand: unique symbol;
|
|
49
|
-
export type Brand<T, TBrand extends string> = T & { [brand]: TBrand };
|
package/tsconfig.json
DELETED