Skip to content

Commit

Permalink
[Docs] Update video calling app tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
sierpinskid committed Nov 20, 2023
1 parent 2c4b22e commit d45cd52
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions docusaurus/docs/Unity/02-tutorials/01-video-calling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,16 @@ And finally, we call the `ConnectUserAsync` method that will attempt to establis
```csharp
await _client.ConnectUserAsync(credentials);
```
It's worth noting that we're using .NET's modern **async/await syntax** - this makes writing asynchronous code that waits for the server response very clean & concise.

After the `await` completes, we should now be connected to the Stream server.
:::note

We've wrapped the asynchronous `ConnectUserAsync` method in a **try/catch** block. In case you're not familiar with handling exceptions in asynchronous methods, we advise you to always wrap awaited methods in a try/catch block to catch any thrown exceptions and therefore never miss any errors that can potentially occur during async operations.
We're using .NET's modern async/await syntax, which makes writing asynchronous code that waits for server response very clean & concise.

:::

After the `await` completes, we should be connected to the Stream server.

We've wrapped the asynchronous `ConnectUserAsync` method in a **try/catch** block. If you're not familiar with handling exceptions in asynchronous methods - we advise you to always wrap awaited methods in a try/catch block to catch any thrown exceptions and never miss any errors that can occur during async operations.

---

Expand All @@ -141,19 +146,19 @@ You should now have a game object with the `VideoManager.cs` script attached.

![GameObject with attached AudioRoomsManager.cs script](../assets/tutorials/video-calls/03.png)

Once you select this game object you should see `Api Key`, `User Id`, and the `User Token` fields visible in the **Inspector** Window (Make sure the `VideoManager` game object is selected).
Once you select the `VideoManager` game object, you should see the `Api Key`, `User Id`, and the `User Token` fields visible in the **Inspector** window.

![GameObject with attached AudioRoomsManager.cs script](../assets/tutorials/video-calls/04.png)

---

### Step 4 - Connect a user to Stream server

To run this script we need a valid **User Token**. A **User Token** is typically generated by your backend service. When a user logs in to your app you authorize them and return the **user token** that allows them to join call. This way, you have full control over who can access a call. For the sake of this tutorial we'll generate a **User Token** for you:
To run this script, we need a valid **User Token**. A **User Token** is typically generated by your backend service. When a user logs in to your app, you authorize them and return the **user token** that allows them to join the call. This way, you have complete control over who can access a call. For the sake of this tutorial, we'll generate a **User Token** for you:

<TokenSnippet sampleApp='meeting' />

Copy `api key`, `user id`, and the `user token` from the window above and paste them into the corresponding fields in the `VideoManager` game object:
Copy the `api key`, `user id`, and the `user token` from the window above and paste them into the corresponding fields in the `VideoManager` game object:

![Filled Credentials](../assets/tutorials/video-calls/05.png)

Expand Down Expand Up @@ -194,7 +199,7 @@ private IStreamVideoClient _client;
private IStreamCall _activeCall;
```

Next, add the `JoinCallAsync` and the `LeaveCallAsync` methods to the `VideoManager` class.
Next, add the following methods to the `VideoManager` class:

```csharp
public async Task JoinCallAsync()
Expand Down

0 comments on commit d45cd52

Please sign in to comment.