Skip to content

Commit

Permalink
Add typescript definition file
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-luther committed Nov 22, 2024
1 parent 790047a commit 2768ee3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import * as React from 'react';

export interface ReactPlayerProps {
url?: string;
playing?: boolean;
loop?: boolean;
controls?: boolean;
volume?: number;
playbackRate?: number;
width?: string|number;
height?: string|number;
hidden?: boolean;
className?: string;
style?: Object;
progressFrequency?: number;
soundcloudConfig?: {
clientId: string,
showArtwork: boolean
};
youtubeConfig?: {
playerVars: Object,
preload: boolean
};
vimeoConfig?: {
iframeParams: Object,
preload: boolean
};
fileConfig?: {
attributes: Object
};
onReady?(): void;
onStart?(): void;
onPlay?(): void;
onPause?(): void;
onBuffer?(): void;
onEnded?(): void;
onError?(error: any): void;
onDuration?(duration: number): void;
onProgress?(state: { played: number, loaded: number }): void;
}

export default class ReactPlayer extends React.Component<ReactPlayerProps, any>{
seekTo(fraction: number): void;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.12.1",
"description": "A react component for playing a variety of URLs, including file paths, YouTube, SoundCloud, Streamable, Vidme and Vimeo",
"main": "lib/ReactPlayer.js",
"typings": "index.d.ts",
"scripts": {
"clean": "rimraf lib demo",
"build:webpack": "NODE_ENV=production webpack --config webpack.config.prod.js",
Expand Down

0 comments on commit 2768ee3

Please sign in to comment.