npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@andrkenya/react-native-jitsi-meet

v1.0.0

Published

React native Wrapper for Jitsi Meet SDK

Downloads

3

Readme

React Native JitsiMeet

React Native Wrapper for Jitsi Meet SDK.

How this wrapper is different:

  1. We have implemented broadcast actions.
  2. Maintained by a startup that uses Jitsi solutions.

JitsiSDK version: 5.1.0 React Native support: 0.68.1

Install

yarn add @vidit-me/react-native-jitsi-meet

or

npm i --save @vidit-me/react-native-jitsi-meet

Usage

The package can be invoked in two modes

  1. As a new Activity/UIViewController on top of RN Application
  2. As a RN View
import JitsiMeet, { JitsiMeetView } from '@vidit-me/react-native-jitsi-meet';
import React, { useState } from 'react';
import { StyleSheet, View, Pressable, Text } from 'react-native';

const conferenceOptions = {
  room: 'ReactNativeJitsiRoom',
  userInfo: {
    displayName: 'React Native Jitsi Meet Example',
    email: '[email protected]',
    avatar: 'https://picsum.photos/200',
  },
  featureFlags: {
    'live-streaming.enabled': false,
  },
};

function App() {
  const [showJitsiView, setShowJitsiView] = useState(false);
  const [muted, setMuted] = React.useState(true);
  const startJitsiAsNativeController = async () => {
    /* 
      Mode 1 - Starts a new Jitsi Activity/UIViewController on top of RN Application (outside of JS).
      It doesn't require rendering JitsiMeetView Component.
    */

    await JitsiMeet.launchJitsiMeetView(conferenceOptions);

    /*
      Note:
        JitsiMeet.launchJitsiMeetView will return a promise, which is resolved once the conference is terminated and the JitsiMeetView is dismissed.
    */
  };

  /*
    The localParticipant leaves the current conference.
  */

  if (showJitsiView) {
    /* Mode 2 - Starts Jitsi as a RN View */

    return (
      <JitsiMeetView
        style={styles.jitsiMeetView}
        options={conferenceOptions}
        onConferenceTerminated={(_) => setShowJitsiView(false)}
        onConferenceJoined={(e) => console.log(e.nativeEvent)}
        onConferenceWillJoin={(e) => console.log(e.nativeEvent)}
      />
    );
  }

  return (
    <View style={styles.container}>
      <Pressable
        onPress={startJitsiAsNativeController}
        style={({ pressed }) => [
          styles.pressable,
          { opacity: pressed ? 0.5 : 1 },
        ]}
      >
        <Text style={styles.pressableText}>
          Start Jitsi on top of RN Application
        </Text>
      </Pressable>
       <Pressable
        onPress={() => {
	        JitsiMeet.sendActions({SET_VIDEO_MUTED: { muted: !muted}});
	        setMuted(!muted);
	        }
        }
        style={({ pressed }) => [
          styles.pressable,
          { opacity: pressed ? 0.5 : 1 },
        ]}
      >
        <Text style={styles.pressableText}>
          Toggle some controller
        </Text>
      </Pressable>
      <Pressable
        onPress={() => setShowJitsiView(true)}
        style={({ pressed }) => [
          styles.pressable,
          { opacity: pressed ? 0.5 : 1 },
        ]}
      >
        <Text style={styles.pressableText}>Start Jitsi as a RN View</Text>
      </Pressable>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  pressable: {
    width: '80%',
    borderRadius: 15,
    height: 50,
    marginVertical: 10,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'blue',
  },
  pressableText: {
    fontSize: 17,
    fontWeight: 'bold',
    textAlign: 'center',
    color: '#fff',
  },
  jitsiMeetView: {
    flex: 1,
  },
});

export default App;

See Options for further information.

iOS install

1.) This library uses Swift code, so make sure that you have created the Objective-C bridging header file.

If not, open your project in Xcode and create an empty Swift file.

Xcode will ask if you wish to create the bridging header file, please choose yes.

For more information check Create Objective-C bridging header file.

2.) Replace the following code in AppDelegate.m (ONLY required for mode 1. If you're using mode 2, skip this step):

UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;

with this one

UIViewController *rootViewController = [UIViewController new];
UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:rootViewController];
navigationController.navigationBarHidden = YES;
rootViewController.view = rootView;
self.window.rootViewController = navigationController;

This will create a navigation controller to be able to navigate between the Jitsi component and your react native screens.

3.) Add the following lines to your Info.plist

<key>NSCameraUsageDescription</key>
<string>Camera Permission</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone Permission</string>
<key>NSCalendarUsageDescription</key>
<string>Calendar Permission</string>

4.) Modify your platform version in Podfile and Xcode to have platform version 12.0 or above.

5.) In Xcode, under Build settings set Enable Bitcode to No and Always Embed Swift Standard Libraries to Yes.

6.) In Xcode, under Signing & Capabilities add the capability Background Modes and check Voice over IP. Otherwise, it won't work well in background.

7.) Clean your project and run npx pod-install.

Android install

1.) In android/app/build.gradle, add/replace the following lines:

project.ext.react = [
    entryFile: "index.js",
    bundleAssetName: "app.bundle",
    ...
]

2.) In android/app/src/main/java/com/xxx/MainApplication.java add/replace the following methods:

  import androidx.annotation.Nullable; // <--- Add this line if not already existing
  ...
    @Override
    protected String getJSMainModuleName() {
      return "index";
    }

    @Override
    protected @Nullable String getBundleAssetName() {
      return "app.bundle";
    }

3.) In android/build.gradle, add the following code

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url "https://maven.google.com"
        }
        maven { // <---- Add this block
            url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
        }
        maven { url "https://jitpack.io" }
    }
}

4.) In the <application> section of android/app/src/main/AndroidManifest.xml, add (ONLY required for mode 1. If you're using mode 2, skip this step)

<activity
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
    android:launchMode="singleTask"
    android:resizeableActivity="true"
    android:supportsPictureInPicture="true"
    android:windowSoftInputMode="adjustResize"
    android:name="com.reactnativejitsimeet.JitsiMeetActivityExtended">
</activity>

5.) And set your minSdkVersion to be at least 24.

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 24 // <-- this line
        compileSdkVersion = 29
        targetSdkVersion = 29
        ndkVersion = "20.1.5948944"
    }
    ...
}

6.) Remove allow back up from Androidmanifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.sdktest">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false" <-- this line
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
    </application>
</manifest>

Meeting Options

| key | Data type | Default | Description | | ------------ | --------- | ------------------- | --------------------------------------------------------------------------------------------------------------- | | room | string | required | Room name for Jitsi Meet | | serverUrl | string | https://meet.jit.si | Valid server URL | | token | string | "" | JWT token | | subject | string | "" | Conference subject (will change the global subject for all participants) | | audioOnly | boolean | false | Controls whether the participant will join the conference in audio-only mode (no video is sent or recieved) | | audioMuted | boolean | false | Controls whether the participant will join the conference with the microphone muted | | videoMuted | boolean | false | Controls whether the participant will join the conference with the camera muted | | userInfo | object | {} | Object that contains information about the participant starting the meeting. See UserInfo | | featureFlags | object | {} | Object that contains information about which feature flags should be set. See below for more info. |

Broadcast Actions - (Android only for the moment)

See the Jitsi Docs.

For examples on how to set feature flags, see the usage example above.

| Key | Value | Default | Description | | ------------ | --------- | ------------------- | --------------------------------------------------------------------------------------------------------------- | | SET_AUDIO_MUTED | Object: { muted: boolean } | false | Sets the state of the localParticipant audio muted according to the muted parameter. Expects a muted key on the intent extra with a boolean value. | | SET_VIDEO_MUTED | Object: { muted: boolean } | false | Sets the state of the localParticipant audio muted according to the muted parameter. Expects a muted key on the intent extra with a boolean value. | | HANG_UP | null | - | The localParticipant leaves the current conference. Expect null value. | | SEND_ENDPOINT_TEXT_MESSAGE | Object: { to?: ParticipantId; message: string; } | false | Sends a message via the data channel to one particular participant or to all of them. Expects a to key on the intent extra with the id of the participant to which the message is meant and a message key with a string value, the actual content of the message. If the to key is not present or it's value is empty, the message will be sent to all the participants in the conference. In order to get the participantId, the PARTICIPANT_JOINED event should be listened for, which data includes the id and this should be stored somehow. | | TOGGLE_SCREEN_SHARE | Object: { enabled: boolean } | false | Sets the state of the localParticipant screen share according to the enabled parameter. Expects a enabled key on the intent extra with a boolean value. | | RETRIEVE_PARTICIPANTS_INFO | Object: { requestId: string } | false | Signals the SDK to retrieve a list with the participants information. The SDK will emit a PARTICIPANTS_INFO_RETRIEVED event. Expects a requestId key on the intent extra with a string value, this parameter will be present on the PARTICIPANTS_INFO_RETRIEVED event. | | OPEN_CHAT | Object: { to: ParticipantId } | {} | Opens the chat dialog. If a to key is present with a valid participantId, the private chat for that particular participant will be opened. | | CLOSE_CHAT | null | - | Closes the chat dialog. Expect null value. |

User Info

| key | Data type | Default | Description | | ----------- | --------- | ------- | ------------------------ | | displayName | string | "" | Participant's name | | email | string | "" | Participant's e-mail | | avatar | string | "" | Participant's avatar URL |

Screen Sharing

It is already enabled by default on Android.

On iOS it requires a few extra steps. Set the flag screenSharingEnabled to true and follow this tutorial Screen Sharing iOS to get it working.

Instructions to run the example app

1.) Clone this project

git clone https://github.com/vidit-me/react-native-jitsi-meet.git

2.) Navigate to the project folder

cd react-native-jitsi-meet

3.) Install dependencies

yarn

4.) Run app

yarn example ios

or

yarn example android

Troubleshooting

Android - If your having problems with duplicate_classes errors, try exclude them from the react-native-jitsi-meet project implementation with the following code:

implementation(project(':vidit-me_react-native-jitsi-meet')) {
  // Un-comment below if using hermes
  exclude group: 'com.facebook',module:'hermes'
  // Un-comment any packages below that you have added to your project to prevent `duplicate_classes` errors
  exclude group: 'com.facebook.react',module:'react-native-locale-detector'
  exclude group: 'com.facebook.react',module:'react-native-vector-icons'
  // exclude group: 'com.facebook.react',module:'react-native-community-async-storage'
  // exclude group: 'com.facebook.react',module:'react-native-community_netinfo'
  // exclude group: 'com.facebook.react',module:'react-native-svg'
  // exclude group: 'com.facebook.react',module:'react-native-fetch-blob'
  // exclude group: 'com.facebook.react',module:'react-native-webview'
  // exclude group: 'com.facebook.react',module:'react-native-linear-gradient'
  // exclude group: 'com.facebook.react',module:'react-native-sound'
}
  • Another problem is with the react-native-reanimated v2, for the moment the main Jitsi SDK doesn't support this version.

TODO

  1. IOS broadcast actions support
  2. Add invoke feature to broadcast actions.
  3. Update example project