Skip to content

SourceBuffer.appendBuffer() is missing overload for ArrayBufferView param in lib.d.ts #314

Closed
@philipbulley

Description

@philipbulley

According to the MediaSource Candidate Recommendation Spec, there are two SourceBuffer.appendBuffer() method overloads.

MSDN only mentions the ArrayBuffer overload, even though this is later contradicted in the example code, further down on the same page:

videoSource.appendBuffer(new Uint8Array(xhr.response));

(Uint8Array indeed inherits from ArrayBufferView, not ArrayBuffer).

My tests show that Chrome 36 currently only works with ArrayBufferView (as per the MSDN example code).

Anyway, long story short:

Here is the lib.d.ts change request, as supported by the spec, MSDN example code and Chrome 36:

Existing:

interface SourceBuffer extends EventTarget {
    updating: boolean;
    appendWindowStart: number;
    appendWindowEnd: number;
    buffered: TimeRanges;
    timestampOffset: number;
    audioTracks: AudioTrackList;
    appendBuffer(data: ArrayBuffer): void;
    remove(start: number, end: number): void;
    abort(): void;
    appendStream(stream: MSStream, maxSize?: number): void;
}

Suggested:

interface SourceBuffer extends EventTarget {
    updating: boolean;
    appendWindowStart: number;
    appendWindowEnd: number;
    buffered: TimeRanges;
    timestampOffset: number;
    audioTracks: AudioTrackList;
    appendBuffer(data: ArrayBuffer): void;
    appendBuffer(data: ArrayBufferView): void;
    remove(start: number, end: number): void;
    abort(): void;
    appendStream(stream: MSStream, maxSize?: number): void;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueRevisitAn issue worth coming back to

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions