Skip to content

Commit

Permalink
Merge pull request #724 from opentok/develop
Browse files Browse the repository at this point in the history
v2.27.0
  • Loading branch information
jeffswartz authored Mar 5, 2024
2 parents 2c3d9c4 + 2894a7e commit 57b8d17
Show file tree
Hide file tree
Showing 24 changed files with 529 additions and 1,180 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.11.0
117 changes: 106 additions & 11 deletions @types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,40 @@ declare module "opentok-react-native" {
timestamp: number,
}

interface PublisherAudioNetworkStats {
connectionId?: string,
subscriberId?: string,
audioPacketsLost: number,
audioBytesSent: number,
audioPacketsSent: number,
timeStamp: number,
}

interface PublisherVideoNetworkStats {
connectionId?: string,
subscriberId?: string,
videoPacketsLost: number,
videoBytesSent: number,
videoPacketsSent: number,
timestamp: number,
}

interface PublisherRtcStatsReport {
connectionId: string,
jsonArrayOfReports: string,
}

interface SignalEvent {
sessionId: string;
fromConnection: string;
connectionId: string;
type: string;
data: string;
}

interface MuteForcedEvent {
active: boolean;
}

interface OTSessionProps extends ViewProps {
/**
* TokBox API Key
Expand Down Expand Up @@ -139,6 +161,13 @@ declare module "opentok-react-native" {
* Event handlers passed into the native session instance.
*/
eventHandlers?: OTSessionEventHandlers;


/**
* Used to set the encryption secret in a session that uses end-to-end encryption.
* See https://tokbox.com/developer/guides/end-to-end-encryption.
*/
encryptionSecret?: string
}

interface OTSessionSessionOptions {
Expand Down Expand Up @@ -219,10 +248,15 @@ declare module "opentok-react-native" {
connectionDestroyed?: CallbackWithParam<ConnectionDestroyedEvent, any>;

/**
* Sent if the attempt to connect to the session fails or if the connection to the session drops due to an error after a successful connection.
* Sent if the attempt to connect to the session fails or if the connection to the session drops due to an error after a successful connection. Also sent if setting an encryption secret results in an error.
*/
error?: CallbackWithParam<ErrorEvent, any>;

/**
* Sent when a moderator has forced clients publishing streams to the session to mute audio (the active property of the MuteForcedEvent object is set to true), or a moderator has disabled the mute audio state in the session (the active property of the MuteForcedEvent object is set to false).
*/
muteForced?: CallbackWithParam<MuteForcedEvent, any>;

/**
* Sent if there is an error with the communication between the native session instance and the JS component.
*/
Expand Down Expand Up @@ -270,7 +304,7 @@ declare module "opentok-react-native" {
}

/**
* https://github.com/opentok/opentok-react-native/blob/master/docs/OTSession.md
* https://tokbox.com/developer/sdks/react-native/reference/OTSession.html
*/
export class OTSession extends React.Component<OTSessionProps, unknown> {
/**
Expand Down Expand Up @@ -328,7 +362,16 @@ declare module "opentok-react-native" {
audioBitrate?: number;

/**
* Whether to turn on audio fallback or not.
* Settings to enable and disable publisher and subscriber audio fallback.
* See https://tokbox.com/developer/guides/audio-fallback.
*/
audioFallback?: {
publisher?: boolean;
subscriber?: boolean;
};

/**
* Deprecated. See the `audioFallback` property.
*/
audioFallbackEnabled?: boolean;

Expand Down Expand Up @@ -394,11 +437,20 @@ declare module "opentok-react-native" {
*/
audioLevel?: CallbackWithParam<number>;

/**
* Sent when publisher audio stats are available.
*/
audioNetworkStats?: CallbackWithParam<PublisherAudioNetworkStats[], any>;
/**
* Sent if the publisher encounters an error. After this message is sent, the publisher can be considered fully detached from a session and may be released.
*/
error?: CallbackWithParam<any, any>;

/**
* Sent when a moderator has forced this publisher's stream to be muted.
*/
muteForced?: Callback<any>;

/**
* Sent if there is an error with the communication between the native publisher instance and the JS component.
*/
Expand All @@ -419,23 +471,51 @@ declare module "opentok-react-native" {
* Sent when the publisher stops streaming.
*/
streamDestroyed?: CallbackWithParam<StreamDestroyedEvent, any>;

/**
* Sent when the publisher stops sending video because of publisher audio fallback (see https://tokbox.com/developer/guides/audio-fallback).
*/
videoDisabled?: CallbackWithParam<{reason: string}>;

/**
* Sent when the publisher is close to going to audio-only fallback becuase of declining network conditions (see https://tokbox.com/developer/guides/audio-fallback).
*/
videoDisableWarning?: Callback<any>;

/**
* Sent after a videoDisableWarning event when network conditions improve (see https://tokbox.com/developer/guides/audio-fallback).
*/
videoDisableWarningLifted?: Callback<any>;

/**
* Sent when the publisher resumes sending video after it was disabled because of publisher audio fallback (see https://tokbox.com/developer/guides/audio-fallback).
*/
videoEnabled?: CallbackWithParam<{reason: string}, any>;

/**
* Sent when publisher video stats are available.
*/
videoNetworkStats?: CallbackWithParam<PublisherVideoNetworkStats[], any>;
}

/**
* https://github.com/opentok/opentok-react-native/blob/master/docs/OTPublisher.md
* https://tokbox.com/developer/sdks/react-native/reference/OTPublisher.html
*/
export class OTPublisher extends React.Component<OTPublisherProps, unknown> {
/**
* Gets the RTC stats report for the publisher. This is an asynchronous operation.
* The OTPublisher object dispatches an rtcStatsReport event when RTC statistics for
* the publisher are available.
*/
getRtcStatsReport?: () => void;
getRtcStatsReport: () => void;

/**
* Sets video transformers for the publisher (or clears them if passed an empty array).
*/
setVideoTransformers?: () => void;
setVideoTransformers: (transformers: Array<{
name: string,
properties?: string,
}>) => void;
}

interface OTSubscriberProps extends ViewProps {
Expand Down Expand Up @@ -471,6 +551,21 @@ declare module "opentok-react-native" {
}

interface OTSubscriberProperties {
/**
* The audio volume, from 0 to 100.
*/
audioVolume?: number;

/**
* The preferred frame rate, in frames per second.
*/
preferredFrameRate?: number;

/**
* The preferred resolution, either "1280x720", "640x480", or "352x288".
*/
preferredResolution?: string;

/**
* Whether to subscribe to audio.
*/
Expand Down Expand Up @@ -542,12 +637,12 @@ declare module "opentok-react-native" {
/**
* This message is sent when the OpenTok Media Router determines that the stream quality has degraded and the video will be disabled if the quality degrades further. If the quality degrades further, the subscriber disables the video and the videoDisabled message is sent. If the stream quality improves, the videoDisableWarningLifted message is sent.
*/
videoDisableWarning?: Callback<any>;
videoDisableWarning?: CallbackWithParam<{stream: Stream});

/**
* This message is sent when the subscriber’s video stream starts (when there previously was no video) or resumes (after video was disabled). Check the reason parameter for the reason why the video started (or resumed).
*/
videoDisableWarningLifted?: Callback<any>;
videoDisableWarningLifted?: CallbackWithParam<{stream: Stream});

/**
* This message is sent when the subscriber’s video stream starts (when there previously was no video) or resumes (after video was disabled). Check the reason parameter for the reason why the video started (or resumed).
Expand All @@ -568,11 +663,11 @@ declare module "opentok-react-native" {
}

/**
* https://github.com/opentok/opentok-react-native/blob/main/docs/OTSubscriber.md#custom-rendering-of-streams
* https://tokbox.com/developer/guides/subscribe-stream/react-native/#custom_rendering
*/
export class OTSubscriberView extends React.Component<OTSubscriberViewProps, unknown> {}
/**
* https://github.com/opentok/opentok-react-native/blob/master/docs/OTSubscriber.md
* https://tokbox.com/developer/sdks/react-native/reference/OTSubscriber.html
*/
export class OTSubscriber extends React.Component<OTSubscriberProps, unknown> {
/**
Expand Down
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# 2.27.0 (March 2024)

- [Update]: Update OpenTok Android SDK and OpenTok iOS SDK to version 2.27.0.

This version adds support for the VP9 codec in relayed sessions. For more information, see the [video codecs](https://tokbox.com/developer/guides/codecs/) documentation.

This version adds support for adaptive media routing. For more information, see the [adaptive media routing](https://tokbox.com/developer/guides/create-session/#adaptive-media-routing) documentation.

For more details, see the release notes for the OpenTok [iOS](https://tokbox.com/developer/sdks/ios/release-notes.html) and [Android](https://tokbox.com/developer/sdks/android/release-notes.html) SDKs.

- [Update]: This version adds support for [end-to-end encryption](https://tokbox.com/developer/guides/end-to-end-encryption). The `OTSession` component includes a new `encryptionSecret` prop, which you can use to set and change the encryption secret used by the local client.

- [Update]: This version adds a new `OTPublisher audioFallback` option, which supports both subscriber and publisher audio fallback. The `audioFallback.subscriber` property replaces the `OTPublisher audioFallbackEnabled` option, which is deprecated.
The OTPublisher component has new callback functions for publisher audio fallback-related events: `videoDisabled()`, `videoEnabled()`, `videoDisableWarning()`, and `videoDisableWarningLifted()`. See the [audio fallback developer guide](https://tokbox.com/developer/guides/audio-fallback).

- [Update]: The `OTPublisher.setVideoTransformer()` method now supports the background image replacement transformer in Android (as well as iOS). And the custom radius option for the background blur filter is now supported in Android (as well as iOS).

- [Update]: The axios package is updated. This updates a vulnerable version of in the follow-redirects dependency.

- [Fix]: This version fixes some issues in the TypeScript definitions.

- [Fix]: This version fixes the following events, which were not being dispatched:

* OTPublisher audioNetworkStats
* OTPublisher videoNetworkStats
* OTPublisher muteForced
* OTSession muteForced

- [Fix]: This version fixes the `OTSession.forceMuteAll()` method in iOS.

# 2.26.1 (October 2023)

- [Update]: The new `OTPublisher.setVideoTransformers()` method lets you set (and clear)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If you've installed this package before, you may need to edit your `Podfile` and
target '<YourProjectName>' do
# Pods for <YourProject>
pod 'OTXCFramework', '2.26.1'
pod 'OTXCFramework', '2.27.0'
end
```
Expand Down Expand Up @@ -148,7 +148,7 @@ allprojects {

## Docs

See the [docs](/docs/index.md).
See the [docs](https://tokbox.com/developer/sdks/react-native/reference).

## Samples

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:${_reactNativeVersion}" // From node_modules
implementation 'com.opentok.android:opentok-android-sdk:2.26.1'
implementation 'com.opentok.android:opentok-android-sdk:2.27.0'
}
Loading

0 comments on commit 57b8d17

Please sign in to comment.