Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: conference app with javascript sdk tutorial #232

Merged
merged 8 commits into from
Dec 6, 2023

Conversation

faiq-naufal
Copy link
Contributor

@faiq-naufal faiq-naufal commented Nov 6, 2023

Description

This PR will add a new docs tutorial under the Hub API section with the title name "Conference App with JavaScript SDK".

@faiq-naufal faiq-naufal self-assigned this Nov 6, 2023
Copy link

cloudflare-workers-and-pages bot commented Nov 6, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: ee7cfa3
Status: ✅  Deploy successful!
Preview URL: https://0d80a561.inlive-website.pages.dev
Branch Preview URL: https://docs-conference-with-js-sdk.inlive-website.pages.dev

View logs

@faiq-naufal faiq-naufal marked this pull request as ready for review November 7, 2023 03:55
}
```

### Add MediaStream input to the peer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to mention about the default publishing video will be done with VP9 and SVC, and pointing out a reference document how to publish media. I need to write the documentation first about publishing video either with VP9 SVC or H264 Simulcast. Later we can refer that with the doc. So for now please create a new draft page with the title publishing media or more relevant title, and fill it with will be updated text.


We need to create a peer which under the hood will manage and establish the WebRTC connection automatically. By now, we are ready to establish the WebRTC connection which will connect multiple peer that communicates with each other. To establish a WebRTC connection, we need to [negotiate a WebRTC connection](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Perfect_negotiation). The negotiation flow is already configured under the hood if you are using the SDK. So, you don't need to worry about that part.

What you need to do to trigger a WebRTC negotiation is by adding a local MediaStream input. We have obtained the local MediaStream earlier when we are asking the user to turn the camera and mic on using `getUserMedia()`. To add a MediaStream, you need to create a peer object and call the `peer.addStream()` method. After this, the negotiation flow will be configured automatically and you can check the peer connection status by getting the peer connection object using `peer.getPeerConnection()`. You can check the [connectionState](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/connectionState) or [iceConnectionState](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState) properties from peer connection object. If the value is `connected`, then the connection has been successfully established and connected. The user has successfully joined to the room.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part, i think needs to be adjusted. Following this issue I don't think auto negotiate when add the stream is a good idea because there is a possibility that a client join a room without want to publish anything like mentioned on the issue. It's better to split addStream and start negotiation. So when the start negotiation called, and no transceiver added to peerConnection object, then it should add new transceiver with recvonly direction.

@faiq-naufal
Copy link
Contributor Author

We need to have this tutorial ready as soon as possible in the production for the webinar. For now, I will merge the current state of the tutorial.

@faiq-naufal faiq-naufal merged commit 798d3c4 into main Dec 6, 2023
1 check passed
@faiq-naufal faiq-naufal deleted the docs/conference-with-js-sdk branch December 6, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants