Update docs a bunch, fix some typos

This commit is contained in:
Vanilagy
2026-04-15 14:36:53 +02:00
parent 606ee87822
commit 7080b79a2a
16 changed files with 508 additions and 116 deletions
+1 -1
View File
@@ -174,7 +174,7 @@ export type ConversionVideoOptions = {
*/
rotate?: Rotation;
/**
* Defaults to `true`. When enabaled, Mediabunny will use the rotation metadata in the output file to perform video
* Defaults to `true`. When enabled, Mediabunny will use the rotation metadata in the output file to perform video
* rotation whenever possible. Set this field to `false` if you want to ensure the output file does not make use of
* rotation metadata and that any rotation is baked into the video frames directly.
*/
+11 -3
View File
@@ -693,8 +693,8 @@ export type CreateInputFromOptions =
* function automatically chooses the correct underlying {@link Source} based on the type of the data passed in.
*
* Legal data types are `ArrayBuffer`, `SharedArrayBuffer`, `ArrayBufferView`, `Blob` (and, by extension, `File`),
* `ReadableStream<Uint8Array>`, `string` (representing either a URL or a local file path), `URL`, and `Request`. Local
* file paths require a Node-like server-side environment with access to the file system.
* `ReadableStream<Uint8Array>`, `string` (representing either a URL or a local file path), `URL`, `Request`, `Source`
* and `PathedSource`. Local file paths require a Node-like server-side environment with access to the file system.
*
* The available options are the union of the options for each {@link Source}. Check the sources to see which field
* applies to which source.
@@ -706,7 +706,7 @@ export type CreateInputFromOptions =
* @public
*/
export const createInputFrom = (
data: AllowSharedBufferSource | Blob | ReadableStream<Uint8Array> | string | URL | Request,
data: AllowSharedBufferSource | Blob | ReadableStream<Uint8Array> | string | URL | Request | Source | PathedSource,
formats: InputFormat[],
options: CreateInputFromOptions = {},
): Input => {
@@ -719,6 +719,14 @@ export const createInputFrom = (
const { initInput, ...sourceOptions } = options;
if (data instanceof Source || data instanceof PathedSource) {
return new Input({
formats,
source: data,
initInput,
});
}
if (
data instanceof ArrayBuffer
|| (typeof SharedArrayBuffer !== 'undefined' && data instanceof SharedArrayBuffer)
+1 -1
View File
@@ -59,7 +59,7 @@ export type PacketRetrievalOptions = {
metadataOnly?: boolean;
/**
* When set to true, key packets will be verified upon retrieval by looking into the packet's bitstream.
* When set to `true`, key packets will be verified upon retrieval by looking into the packet's bitstream.
* If not enabled, the packet types will be determined solely by what's stored in the containing file and may be
* incorrect, potentially leading to decoder errors. Since determining a packet's actual type requires looking into
* its data, this option cannot be enabled together with `metadataOnly`.
+1 -1
View File
@@ -952,7 +952,7 @@ export const simplifyRational = (rational: Rational): Rational => {
* @public
*/
export type Rectangle = {
/** The distance in pixels to the left edge of the rectangle . */
/** The distance in pixels to the left edge of the rectangle. */
left: number;
/** The distance in pixels to the top edge of the rectangle. */
top: number;
+3
View File
@@ -1283,6 +1283,9 @@ export type HlsOutputFormatOptions = {
* - One .m3u8 file for each playlist, each containing a list of media segments.
* - Many media segments, containing the actual media data.
*
* To emit media playlists that use the `#EXT-X-PROGRAM-DATE-TIME` tag to map segment timestamps to real-world time,
* set {@link BaseTrackMetadata.isRelativeToUnixEpoch} to `true` for all tracks.
*
* @group Output formats
* @public
*/
+2 -2
View File
@@ -492,7 +492,7 @@ export type UrlSourceOptions = {
* failed. If the function returns `null`, no more retries will be made.
*
* By default, it uses an exponential backoff algorithm that never gives up unless
* a CORS error is suspected (`fetch()` did reject, `navigator.onLine` is true and origin is different)
* a CORS error is suspected (`fetch()` did reject, `navigator.onLine` is true and origin is different).
*/
getRetryDelay?: (previousAttempts: number, error: unknown, url: string | URL | Request) => number | null;
@@ -2187,7 +2187,7 @@ export class RangedSource extends Source {
* @group Input sources
* @public
*/
export class PathedSource<S extends Source> {
export class PathedSource<S extends Source = Source> {
/** Creates a new {@link PathedSource} from a root path and a callback. */
constructor(
/** The path that points to the root file; the entry file of the media. */