Skip to content

Commit

Permalink
recordkit: Add documentation page for HLS
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-cain13 committed Nov 19, 2024
1 parent 09ea0eb commit e89c1e0
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
6 changes: 6 additions & 0 deletions recordkit/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export default defineConfig({
{ text: 'Try using Electron', link: '/try-electron' },
]
},
{
text: 'Guides',
items: [
{ text: 'Output formats', link: '/guides/output-formats' },
]
},
{
text: 'References',
items: [
Expand Down
59 changes: 59 additions & 0 deletions recordkit/guides/output-formats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Output formats

RecordKit can record towards different file formats, either a single file (mov/mp4/m4a) or a segmented (HLS) stream.

## Single file

### mov/m4a

Recording to a regular mov file is the default in RecordKit. In the case only audio is present a m4a file will be created. RecordKit will use the H.264 and AAC codecs to compress the video and audio content by default.

### mp4

The mp4 container is also supported by providing an explicit filename with the mp4 extension. Like the below example.

::: code-group
```swift [Swift]
RKRecorder([
.display(displayID: selectedDisplay, filename: "display.mp4")
])
```

```ts [Electron]
await recordkit.createRecorder({
items: [
{ type: 'display', display: selectedDisplay, filename: "display.mp4" }
]
})
```
:::

## Segmented stream (HLS)

When uploading files to a backend it might be beneficial to write out the audio and video in smaller segments that can be uploaded while the recording is still running. RecordKit can output an segmented media stream also known as HLS/fMP4.

Enable this by setting the output parameter to `segmented`, optionaly passing a callback that will be called with every segment that is written out to disk. Like the below example.

::: code-group
```swift [Swift]
RKRecorder([
.display(displayID: selectedDisplay, output: .segmented(segmentCallback: { url in
print("A new segment is written to \(url)")
}))
])
```

```ts [Electron]
await recordkit.createRecorder({
items: [
{ type: 'display', display: selectedDisplay, output: 'segmented', segmentCallback: (path) => { console.log('A new segment is written to', path) } },
]
})
```
:::

An m3u8 playlist file will also be created that refers to all fragments that can be used for playback.

## Other formats

If you require output in other formats please [drop us an email](mailto:[email protected])! We're happy to see if we can expand support to your requested format.

0 comments on commit e89c1e0

Please sign in to comment.