Giter Club home page Giter Club logo

telimed's Introduction

Purpose

This is a proof of concept for embedding Jitsi video and audio conferencing into a react app.

Summary

There are two APIs available from Jitsi to accomplish this: Jitsi Meet and Lib Jitsi Meet. Jitsi Meet is a high level API that embeds the entire Jitsi Meet interface into a div within your app. Styling is very limited and control is pretty limited but as far as easy of use goes, I had it working within a few minutes. Lib Jitsi Meet is the lower level API used by Jitsi Meet to control the audio/video/text elements directly. This route is much harder and took me about 4 days to figure out. There are a lot of small concepts that you have to understand to get this API to work.

Findings

  • You have to include the lib-jitsi-meet.js file in your html page and let it attach to the window. This file is available from a Jitsi Server installation at the URL //your.jitsi.server.fqdn/libs/lib-jitsi-meet.min.js. You can also use //your.jitsi.server.fqdn/external_api.js. This will include both Meet and Lib Meet. I chose to only include Lib Meet since I wanted full control over the UI. This file is fully compressed and worthless for debugging. To make it easier to debug I check out the github library directly and built it locally then run the webpack command without the -p option to get an uncompressed version with source maps.

  • The API has about 5 major parts and is pretty well documented here. There is also an example app here but since I wanted to use react I did not even try running it so I am not sure if it works but I did reference it alot.

  • The main pitfall in react is to not use any Jitsi API ojects as state or props. Instead attach them to the component directly or to the window object and let your components reach them from there. I tried a number of ways to pass them and it would seem to work but then I would get random errors of max state update calls. Instead of passing them as props directly, I found passing a primative repersentation of them worked better. For example, you have audio and video tracks which repersent the Mic and Webcam as API objects. You have to attach these to audio and video html 5 tags for each remote participant. In react world, it made sense to make a remote participant component to display them. The problem is I could not pass the tracks to the component due to the max state errors. The solution was to passed the unique IDs for these objects that look like GUIDs as strings. In the component's did update, when I detected a change in ID I queried the window oject which was created by a parent component for the real API objects and stored them locally on my component but not as state. This let me use react components to break up the display without passing the Lib Meet API objects directly.

  • The example was very helpful but I found that for local audio tracks creating an audio tag and attaching the local mic to it would cause me to hear myself as an echo when I talked. Even with the muted=true attribute it still happened. If I just ignored creating an audio tag for the local mic it seems to work.

  • To hear remote mics I had to set the AudioOutputDeviceId for each track. The example did this at the mediadevices level but this did not work for me for some reason.

Conclusion

It is possible to use Jitsi lib to directly embed meet elements into your react app. You can not take a traditional react approach and store Jitsi API objects as props or state or context. You can still break your UI into components but those components will have to access some shared ojected outside React to use Jitsi. This poc only supports audio and video, you see a working example of it below:

https://fpw23.github.io/telimed/

Open this URL on two different computers and point them to the same room. You will seen yourself on the Me box and everyone else on the Them box.

telimed's People

Contributors

fpw23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

telimed's Issues

jitsi-meet server with selfsigned certificate

Hi,
I've installed jitsi meet using this guide:
https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-docker
I'm using a self signed certificate and I'm trying to use your project with my own jitsi-meet server.

I tried to use my url
<my_ip>8443 instead of beta.meet.jit.si and I obtain the following error:
WebSocket connection to 'wss://<my-ip>/xmpp-websocket?room=workshop014' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED 2020-10-28T09:58:50.873Z [modules/xmpp/strophe.util.js] <Object.r.Strophe.log>: Strophe: Websocket error [object Event]

Can you tell me where is the error?
thanks

Angelo

Connection Establish Error

Hi there,
I am working on a video conference project and I am using your project as a jumping off point for foundational parts of the Jitsi connection. It has been working perfectly so far but recently I have run into a couple issues when trying to connect. At first, it appeared to be a similar issue to the other issue in this repository, but looking further into the issue, I don't believe it to be the same after all. The errors that I have gotten are as follows:

WebSocket connection to 'wss://beta.meet.jit.si/xmpp-websocket?room=franktest' failed: Error during WebSocket handshake: Unexpected response code: 403

and

connect @ strophe.umd.js:5463
<Object../modules/xmpp/strophe.util.js.webpack_exports.default.strophe_js__WEBPACK_IMPORTED_MODULE_1
_.Strophe.log>: Strophe: Websocket error [object Event]

I have tried reverting back to your version of the application and I am getting the same error as well, so I'm not sure if it's something out of our control.

Any suggestions on how to get a successful connection with the websocket? I am not super familiar with a lot of this backend stuff, and through some digging it looks like it may have to do with passing a token in the JitsiConnection function, but I am unsure at this point.

Problem starting Jitsi / AudioContext on page load

Hi Frank, I stumbled onto this when researching how to use lib-jitsi-meet. You've done awesome work providing a MWE and sharing your findings.

I'm working on porting your example to Scala.js React, and I have my version mostly working but I'm running into a problem:

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

Basically I can't grab ahold of the mic and start recording/playing audio on page load. This is particularly a problem because I think the AudioContext is being started when I initialize Jitsi, which I would like to do on page load.

Perhaps I could add some extra logic to get around this by reaching in and finding the audio context and telling it to resume or something. But I noticed your example doesn't have this problem, and I couldn't find anything in the code addressing it. Did you run into this issue? Did you do something to fix it?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.