Skip to content

Commit

Permalink
Export types needed for Egress usage with 2.0 (#137)
Browse files Browse the repository at this point in the history
* Export types needed for Egress usage with 2.0

* changeset

* revert package changes
  • Loading branch information
davidzhao authored Feb 18, 2024
1 parent 9046da4 commit c2880be
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-peaches-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-server-sdk': patch
---

Export types needed for Egress
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
## Migrate from v1.x to v2.x

### Token generation

Because the `jsonwebtoken` lib got replaced with `jose`, there are a couple of APIs that are now async, that weren't before:

```typescript
Expand Down Expand Up @@ -46,6 +48,47 @@ app.post('/webhook-endpoint', async (req, res) => {
});
```

### Egress API

Egress request types have been updated from interfaces to classes in the latest version. Additionally, `oneof` fields now require an explicit `case` field to specify the value type.

For example, to create a RoomComposite Egress:

```typescript
// v1
// const fileOutput = {
// fileType: EncodedFileType.MP4,
// filepath: 'livekit-demo/room-composite-test.mp4',
// s3: {
// accessKey: 'aws-access-key',
// secret: 'aws-access-secret',
// region: 'aws-region',
// bucket: 'my-bucket',
// },
// };

// const info = await egressClient.startRoomCompositeEgress('my-room', {
// file: fileOutput,
// });

// v2 - current
const fileOutput = new EncodedFileOutput({
filepath: 'dz/davids-room-test.mp4',
output: {
case: 's3',
value: new S3Upload({
accessKey: 'aws-access-key',
secret: 'aws-access-secret',
bucket: 'my-bucket',
}),
},
});

const info = await egressClient.startRoomCompositeEgress('my-room', {
file: fileOutput,
});
```

## Installation

### Pnpm
Expand Down
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@ export * from './RoomServiceClient.js';
export * from './WebhookReceiver.js';
export * from './grants.js';
export {
AliOSSUpload,
AzureBlobUpload,
DirectFileOutput,
EgressInfo,
EncodedFileOutput,
EncodedFileType,
EncodingOptions,
EncodingOptionsPreset,
GCPUpload,
ParticipantEgressRequest,
RoomCompositeEgressRequest,
S3Upload,
SegmentedFileOutput,
SegmentedFileProtocol,
StreamOutput,
StreamProtocol,
TrackCompositeEgressRequest,
TrackEgressRequest,
WebEgressRequest,
} from './proto/livekit_egress_pb.js';
export {
IngressAudioEncodingOptions,
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"name": "LiveKit JS Server SDK",
"out": "docs",
"theme": "default"
},
"ts-node": {
"esm": true
}
}

0 comments on commit c2880be

Please sign in to comment.