mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 19:03:46 +02:00
Add HLS live mode
This commit is contained in:
@@ -92,13 +92,13 @@ A progress of `1` doesn't indicate the conversion has finished; the conversion i
|
||||
Tracking conversion progress can slightly affect performance as it requires knowledge of the input file's total duration. This is usually negligible but should be avoided when using append-only input sources such as [`ReadableStreamSource`](./reading-media-files#readablestreamsource).
|
||||
:::
|
||||
|
||||
If you want to monitor the output size of the conversion (in bytes), simply use the `onwrite` callback on your `Target`:
|
||||
If you want to monitor the output size of the conversion (in bytes), simply use the `write` event on your `Target`:
|
||||
```ts
|
||||
let currentFileSize = 0;
|
||||
|
||||
output.target.onwrite = (start, end) => {
|
||||
const stopListening = output.target.on('write', ({ start, end }) => {
|
||||
currentFileSize = Math.max(currentFileSize, end);
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
### Canceling a conversion
|
||||
|
||||
@@ -223,14 +223,14 @@ The _output target_ determines where the data created by the `Output` will be wr
|
||||
|
||||
---
|
||||
|
||||
All targets have an optional `onwrite` callback you can set to monitor which byte regions are being written to:
|
||||
All targets emit a `write` event you can listen to in order to monitor which byte regions are being written to:
|
||||
```ts
|
||||
target.onwrite = (start, end) => {
|
||||
const stopListening = target.on('write', ({ start, end }) => {
|
||||
// ...
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
You can use this to track the size of the output file as it grows. But be warned, this function is chatty and gets called *extremely* frequently.
|
||||
You can use this to track the size of the output file as it grows. But be warned, this event is chatty and gets fired *extremely* frequently.
|
||||
|
||||
### `BufferTarget`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user