Skip to content

Commit

Permalink
Add typing (#2)
Browse files Browse the repository at this point in the history
* chore: Add typing

* fix: revert package name

* fix: typing

* fix: missing files

* chore: 0.5.3
  • Loading branch information
ci7lus authored Aug 14, 2022
1 parent 887dafe commit 7f32754
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 3 deletions.
74 changes: 74 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
export type PixelFormat = "RV32" | "I420";
declare enum _VLCAudioChannel {
Stereo = 0,
ReverseStereo = 1,
Left = 2,
Right = 3,
Dolby = 4,
}
export type VLCAudio = {
readonly count: number;
readonly [key: number]: string;
track: number;
mute: boolean;
volume: number;
channel: _VLCAudioChannel;
delay: number;
};
export type VLCSubtitle = {
readonly count: number;
readonly [key: number]: string;
track: number;
delay: number;
};
export type VLCInput = {
readonly length: number;
readonly fps: number;
readonly state: number;
readonly hasVout: boolean;
position: number;
time: number;
rate: number;
};
export interface Player {
readonly vlcVersion: string;
readonly playing: boolean;
readonly length: number;
pixelFormat: PixelFormat;
time: number;
volume: number;
mute: boolean;
play: (url?: string) => void;
pause: () => void;
togglePause: () => void;
stop: () => void;
toggleMute: () => void;
close: () => void;
onMediaChanged: () => void;
onBuffering: (percents: number) => void;
onPlaying: () => void;
onPaused: () => void;
onEncounteredError: () => void;
onEndReached: () => void;
onStopped: () => void;
onTimeChanged: (time: number) => void;
onPositionChanged: (time: number) => void;
onSeekableChanged: (seekable: boolean) => void;
onPausableChanged: (pausable: boolean) => void;
onLengthChanged: (length: number) => void;
onLogMessage: (level: string, message: string, format: string) => void;
onFrameReady: (
frame: {
width: number;
height: number;
uOffset: number;
vOffset: number;
} & Uint8Array
) => void;
audio: VLCAudio;
subtitles: VLCSubtitle;
position: number;
input: VLCInput;
}
export const createPlayer: (args?: string[]) => Player;
export const path: string | undefined;
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webchimera.js",
"description": "libvlc binding for Electron",
"version": "0.5.2",
"version": "0.5.3",
"license": "LGPL-2.1",
"author": "Sergey Radionov <rsatom@gmail.com>",
"keywords": [
Expand All @@ -13,13 +13,21 @@
],
"repository": {
"type": "git",
"url": "https://github.com/RSATom/WebChimera.js"
"url": "https://github.com/neneka/WebChimera.js"
},
"dependencies": {
"bindings": "~1.2.1"
},
"devDependencies": {
"cmake-js": "^6.3.2"
},
"packageManager": "yarn@1.22.17"
"packageManager": "yarn@1.22.18",
"files": [
"package.json",
"index.js",
"index.d.ts",
"deps/libvlc_wrapper"
],
"main": "index.js",
"types": "index.d.ts"
}

0 comments on commit 7f32754

Please sign in to comment.