RTCPeerConnection | tiny browser module that gives normalizes | Runtime Evironment library

 by   otalk JavaScript Version: 8.4.0 License: No License

kandi X-RAY | RTCPeerConnection Summary

kandi X-RAY | RTCPeerConnection Summary

RTCPeerConnection is a JavaScript library typically used in Server, Runtime Evironment, Nodejs applications. RTCPeerConnection has no bugs, it has no vulnerabilities and it has low support. You can install using 'npm i rtcpeerconnection' or download it from GitHub, npm.

A tiny browser module that normalizes and simplifies the API for WebRTC peer connections. It gives us a cleaner (cross-browser) way to handle offer/answer and is based on an event emitter. If you're not using browserify or you want AMD support use rtcpeerconnection.bundle.js.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              RTCPeerConnection has a low active ecosystem.
              It has 194 star(s) with 59 fork(s). There are 22 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 7 open issues and 24 have been closed. On average issues are closed in 118 days. There are 5 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of RTCPeerConnection is 8.4.0

            kandi-Quality Quality

              RTCPeerConnection has 0 bugs and 0 code smells.

            kandi-Security Security

              RTCPeerConnection has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              RTCPeerConnection code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              RTCPeerConnection does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              RTCPeerConnection releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.
              RTCPeerConnection saves you 2 person hours of effort in developing the same functionality from scratch.
              It has 7 lines of code, 0 functions and 8 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed RTCPeerConnection and discovered the below as its top functions. This is intended to give you an instant insight into RTCPeerConnection implemented functionality, and help decide if they suit your requirements.
            • Creates a new PeerConnection .
            • format a value into a string
            • The base implementation of _ . clone .
            • Format a property .
            • Clones an object .
            • Try to run clear
            • Run setTimeout .
            • Inspect a value .
            • Drushes messages to the queue .
            • Reduce the output to a single string
            Get all kandi verified functions for this library.

            RTCPeerConnection Key Features

            No Key Features are available at this moment for RTCPeerConnection.

            RTCPeerConnection Examples and Code Snippets

            API
            JavaScriptdot img1Lines of Code : 60dot img1no licencesLicense : No License
            copy iconCopy
            /* Minimal RTC Wrapper
             *
             * @param {Object={}} options They can be:
             *   {Object|Boolean} dataChannel Does this peer have a DataChannel? If so,
             *                    you can setup some custom config for it
             *   {MediaStream} stream The MediaStream o  
            Real life Capability testing and utilities for WebRTC.,How to use,0.
            JavaScriptdot img2Lines of Code : 13dot img2License : Permissive (MIT)
            copy iconCopy
            {
                    video : {
                        basic    : true
                    },
                    audio : {
                        basic    : true,
                        webAudio : true
                    },
                    rtcPeerConnection : true,
                    rtcDataChannel    : false,
                    getUserMedia      : "prefix-  

            Community Discussions

            QUESTION

            useRef expressions using question marks in React Native
            Asked 2022-Mar-12 at 17:16

            I was learning a bit about using 'useRef' hooks in React Native functions. While examining some code I found on the Internet...I saw usage including question marks ("?"), like this (as noted in the code):

            ...

            ANSWER

            Answered 2022-Mar-12 at 08:26

            it's look you don't need ?. on your example, it's optional chaining, and one more, please add you cunstruction to the ref

            Source https://stackoverflow.com/questions/71448049

            QUESTION

            Webrtc : how to add streams to a connected RTCPeerConnection?
            Asked 2022-Feb-15 at 15:41

            I am using pure HTTP polling for establish connections.

            PC1 : opens cam, create and send his offer.

            PC2 : accepts offer, create answer, send answer.

            PC1 and PC2 are connected and PC2 can watch PC1 cam.

            Now PC2 opens his cam :I display the local webcam and add video and audio to the connected pc (RTCPeerConnection)

            ...

            ANSWER

            Answered 2022-Feb-15 at 15:41

            Since adding the streams changes the SDP you need to renegotiate, i.e. call createOffer, setLocalDescription and (after getting an answer from the remote end) setRemoteDescription. This is called renegotiation (and you will notice the negotiationneeded event firing).

            This sample shows upgrading an audio-only call to an audio-video one but the same principle applies.

            Note that in your case you are changing who sends the offer so you might run into a problem called 'glare' which is explained nicely in this Mozilla blog post.

            Source https://stackoverflow.com/questions/71126952

            QUESTION

            Get available and active ICE candidates for WebRTC connection
            Asked 2022-Feb-03 at 10:31

            I'm having a weird issue with a WebRTC connection between 2 users on different networks.

            User A is using a phone hotspot, user B is on my home WiFi.

            When user A is the first to join the page, this user sends an offer and some ICE candidates to user B. User B sends an answer and some ICE candidates back to user A, but after about 20 seconds the ICE connection state changes to "failed" (safari) or "disconnected" (chrome). User A and user B are unable to setup a working WebRTC connection.

            However, when user B is the first to join the page & creates the offer, and user A sends back an answer, both users are able to connect without issue.

            In both cases, user A & user B both have a correct looking localDescription & remoteDescription on their end, but in the second case where the connection fails, the connectionState & ICEConnectionState are "failed" (safari) or "disconnected" (chrome) for both users.

            I am using both a TURN and STUN server in my RTCPeerConnection's configuration, and tested the server is working properly using the Trickle ICE WebRTC example

            I suspect that somehow user A or user B are unable to see or use all the available ICE candidates for the other user, however I'm unsure how best to troubleshoot the issue. Is there an easy way to see what ICE candidates are available / active for a given RTCPeerConnection object?

            Update:

            Looking at the chrome://webrtc-internals (as philipp-hancke sugested) shows that

            if user B sends the offer: 4 ICE candidate pairs are available (2 host, 1 srflx, 1 relay) An ICE candidate pair using the external IP for user B, and a TURN server relay for user A is selected. The connection works.

            If user A sends the offer: Again 4 ICE candidate pairs are available (2 host, 1 srflx, 1 relay), but the ICE Candidate pair shows (not connected) and no WebRTC connection is made

            Update 2: I've accepted Philipp Hancke's answer since it answered the initial question I asked, even it I haven't solved my problem yet. I've asked a new question here.

            ...

            ANSWER

            Answered 2022-Jan-31 at 20:47

            This sounds like a long-standing bug in webrtc. Using TURN servers typically solves the problem which explains why this hasn't been a priority for anyone to work on.

            chrome://webrtc-internals is the one-shop-stop location to go for debugging issues like this.

            Source https://stackoverflow.com/questions/70929053

            QUESTION

            How to detect network disconnects (on an RTCPeerConnection) as soon as possible or the resulting frozen video?
            Asked 2022-Feb-01 at 20:39

            I am using RTCPeerconnections to submit video and audio in a web-RTC-based video-messenger. I am able to detect network disconnects after approximately 7 seconds - yet, this is 7 seconds in which the user is staring at a frozen video and starts to randomly click buttons in the app. I would like to improve the user experience by shortening this timespan - e.g. by informing the user about a network issue if the video freezes for more than 1 second.

            Status Quo: I am currently detecting respective situations by listening to the onconnectionstatechange event of the RTCPeerConnection. Yet, the event is only fired approximately 7 seconds after the disconnect. I determined the ~7 seconds by connecting two machines via normal WiFi, using a hardware switch on one of the laptops to switch off the wireless (such switches exist on some older Lenovo models / guarantee an immediate disconnect) and wait for the other machine to detect the event.

            Consideration: The root cause being the interruption of the underlying network connection, it would be ideal to detect the changed network status as early as possible (even if its just transport delays). This said, the disturbance faced by the user ultimately stems from the video that instantly freezes when interrupting the network. If there was no way to detect the connection issue earlier, it could be an option to detect the frozen video instead. Is any of these two things possible (ideally event-driven, so that I don't need to poll things every second)?

            Here's a very simple code snippet describing my current disconnect detection:

            ...

            ANSWER

            Answered 2022-Jan-29 at 08:23

            (ice)connectionstatechange is the right event in general.

            If you want more granularity you'll need to poll getStats and looks for stats like framesReceived. But there is no guaranteed frame rate sent from the other side (e.g. in screensharing you go below 1/s).

            While the actual ICE statistics like requestsSent seem more useful they happen much less frequently, only once per second and you can loose a packet or it comes late.

            In general this is a question of how reliable the detection of the network failure is. If it is too aggressive you end up with a poor UX showing a warning too often. You might not end up that is significantly better than at the cost of introducing complexity that you need to maintain.

            Source https://stackoverflow.com/questions/70901048

            QUESTION

            Webrtc video streaming working properly in localhost but not working in production (using google turn server)
            Asked 2022-Jan-12 at 09:03

            In local server, video streaming is running proper on both ends but while network changed video of one peer is not going to display to other peer.

            I am using google stun server for connection of peer with another network, but then video streaming of one user is not visible here is my code

            I am not able to understand what I am doing wrong here.I am novice in webrtc

            ...

            ANSWER

            Answered 2022-Jan-12 at 06:27

            as you move out side of the network the webrtc ICE candidate gathering process may fail because of Routers NAT and firewalls therefore you must have a turn server in your configuration that will relay the traffic if the direct p2p connection establishment fails

            Source https://stackoverflow.com/questions/70663103

            QUESTION

            Push local WebRTC stream to a NodeJS server in the cloud
            Asked 2021-Dec-16 at 06:33

            I have a task, but I can't seem to get it done. I've created a very simple WebRTC stream on a Raspberry Pi which will function as a videochat-camera. With ionic I made a simple mobile application which can display my WebRTC stream when the phone is connected to the same network. This all works.

            So right now I have my own local stream which shows on my app. I now want to be able to broadcast this stream from my phone to a live server, so other people can spectate it.

            I know how to create a NodeJS server which deploys my webcam with the 'getUserMedia' function. But I want to 'push' my WebRTC stream to a live server so I can retrieve a public URL for it.

            Is there a way to push my local Websocket to a live environment? I'm using a local RTCPeerConnection to create a MediaStream object

            ...

            ANSWER

            Answered 2021-Dec-10 at 16:54

            Is there a way to push my local Websocket to a live environment?

            It's not straightforward because you need more than vanilla webrtc (which is peer-to-peer). What you want is an SFU. Take a look at mediasoup.

            To realize why this is needed think about how the webrtc connection is established in your current app. It's a negotiation between two parties (facilitated by a signaling server). In order to turn this into a multi-cast setup you will need a proxy of sorts that then establishes separate peer-to-peer connections to all senders and receivers.

            Source https://stackoverflow.com/questions/70260437

            QUESTION

            Webrtc on Python failing to change ICE connection state between peers
            Asked 2021-Dec-10 at 15:13

            First, I want to mention that I am very new to WebRTC, so any advice would be very helpful.

            Currently I am using aiortc library to build my own WebRTC app. Here is what I am trying to do.

            I have 2 peers, one is web browser, which is written in javascript, and another one is python script, which is working as signaling server and peer at the same time. So If you access to my web page, you will send video frame to server and then the server will make modification of that then send it back.

            So I finished testing my app on LAN environment and everything worked as I expected. But once I deployed my app to remote server (Google cloud run) , I encountered Ice connection state failing issue. And gets this log on remote server.

            enter image description here

            (I think it is due to disconnection between peers, not low memory problem. I tried with 16GB RAM and 4 cpus and still didn't work)

            Then, I dig into more information, and found that TURN/STUN server is necessary to build WebRTC app over Internet. So I added google STUN server to my RTCPeerConnection like this. [{'urls': 'stun:stun.l.google.com:19302'}, {'urls': 'stun:stun1.l.google.com:19302'}, {'urls': 'stun:stun2.l.google.com:19302'}] (I added both side on javascript and python because both side is working as peer) Unfortunately, it still didn't work.

            Now, I am planning to build my own TURN server, but I am afraid if TURN server wouldn't solve this problem. So I would like to have any advice from you since I am quite stuck within my situation.

            p.s I have done SSL encryption.(So GetUserMedia is working fine)

            Sdp details(Offer/Answer):

            SDP

            Offer

            ...

            ANSWER

            Answered 2021-Dec-10 at 15:13

            If everything work on local, and this ice server are set, verify that your gcloud server have the correct firewall for webrtc port (not only your signaling port, check the sdp/ice you exchange). also this Webrtc page allow you to check is a stun/turn work on your client

            You will not need stun on your python side, as it's a server his ip may be public (unless you don't want to). Stun allow to find your public ip and allow the port to remain open.

            On your server you need to open your signaling port (certainly the WS where you exchange the sdp) and the P2P port (candidate lines in the sdp), the media/data will go through this one. For each media (sdp m line) there are usually one used port.

            Source https://stackoverflow.com/questions/70300816

            QUESTION

            Change the cells of a table in an interval time using OData model
            Asked 2021-Nov-11 at 14:14

            I have this code and I need my table to show the first 10 patients and, after 10 seconds, show the next 10 without touching any button (automatically).

            I'm looking for something similar to this: https://embed.plnkr.co/ioh85m5OtPmcvPHyl3Bg/

            But with an OData model (as specified on my view and controller).

            This is my view:

            ...

            ANSWER

            Answered 2021-Sep-30 at 06:39
            1. You could bind you items using bindItems, pass skip,top parameters and wrap the whole thing in a setInterval

            Source https://stackoverflow.com/questions/69379449

            QUESTION

            Can't hear MediaStream through WebRTC
            Asked 2021-Nov-07 at 18:13

            I'm trying to get a sort of voice chat working using WebRTC and a WebSocket for exchanging offers.

            First I create my RTCPeerConection

            ...

            ANSWER

            Answered 2021-Nov-07 at 18:13

            So it turns out I completely missed a step. Both Caller and Callee need to exchange their ice candidates. So I added the following code:

            Source https://stackoverflow.com/questions/69873099

            QUESTION

            WebRTC iceConnectionState has always been 'checking' state; (use coturn)
            Asked 2021-Sep-23 at 18:27

            I want to make a simple video web chat tool, using webrtc and weosocket.
            Use coturn as a stun and turn server.
            It can be used normally in the local area network, but it will be iceConnectionState has been checking on the public network.

            The following is the implementation code, basically from https://github.com/webrtc/samples/blob/gh-pages/src/content/peerconnection/pc1/js/main.js caller.js:

            ...

            ANSWER

            Answered 2021-Sep-23 at 18:27

            The cause of the problem is that the IceCandidate of server.js is not sent to caller.js

            Modify server.js

            Source https://stackoverflow.com/questions/69303043

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install RTCPeerConnection

            You can install using 'npm i rtcpeerconnection' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i rtcpeerconnection

          • CLONE
          • HTTPS

            https://github.com/otalk/RTCPeerConnection.git

          • CLI

            gh repo clone otalk/RTCPeerConnection

          • sshUrl

            git@github.com:otalk/RTCPeerConnection.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link