Skip to content

Commit

Permalink
Merge pull request #15 from shakaran/patch-2
Browse files Browse the repository at this point in the history
Update README.md file, added namespaces.
  • Loading branch information
p-delorme authored Mar 2, 2024
2 parents 95bd63a + 9019fba commit 6a6a4ca
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ You may store credentials in environment variables. If host, api-key or api-secr
Creating a token for participant to join a room.

```php

use Agence104\LiveKit\AccessToken;
use Agence104\LiveKit\AccessTokenOptions;
use Agence104\LiveKit\VideoGrant;

// If this room doesn't exist, it'll be automatically created when the first
// client joins.
$roomName = 'name-of-room';
Expand Down Expand Up @@ -56,6 +61,8 @@ By default, the token expires after 6 hours. you may override this by passing in
Converting the JWT Token into a ClaimGrants.

```php
use Agence104\LiveKit\AccessToken;

// Initialize and parse the JWT Token.
$claimGrants = (new AccessToken('api-key', 'secret-key'))
->fromJwt($token);
Expand All @@ -66,6 +73,8 @@ $claimGrants = (new AccessToken('api-key', 'secret-key'))
It's possible to customize the permissions of each participant:

```php
use Agence104\LiveKit\VideoGrant;

$videoGrant = (new VideoGrant())
->setRoomJoin() // TRUE by default.
->setRoomName('name-of-room')
Expand All @@ -81,6 +90,8 @@ This will allow the participant to subscribe to tracks, but not publish their ow
`RoomServiceClient` gives you APIs to list, create, and delete rooms. It also requires a pair of api key/secret key to operate.

```php
use Agence104\LiveKit\RoomServiceClient;
use Agence104\LiveKit\RoomCreateOptions;

$host = 'https://my.livekit.host';
$svc = new RoomServiceClient($host, 'api-key', 'secret-key');
Expand Down Expand Up @@ -141,4 +152,4 @@ lando test
#### Step 7:
Once tests are completed, it is time to clean up.
- End the `lando start-test-users` command.
- Run `lando delete-test-room` to delete the test room.
- Run `lando delete-test-room` to delete the test room.

0 comments on commit 6a6a4ca

Please sign in to comment.