-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
9,326 additions
and
8,595 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"include": ["types/*.d.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Component, ReactElement, CSSProperties } from 'react' | ||
import ReactPlayer from './index' | ||
|
||
interface SourceProps { | ||
src: string | ||
type: string | ||
} | ||
|
||
export interface BaseReactPlayerProps { | ||
url?: string | string[] | SourceProps[] | MediaStream | ||
playing?: boolean | ||
loop?: boolean | ||
controls?: boolean | ||
volume?: number | ||
muted?: boolean | ||
playbackRate?: number | ||
width?: string | number | ||
height?: string | number | ||
style?: CSSProperties | ||
progressInterval?: number | ||
playsinline?: boolean | ||
playIcon?: ReactElement | ||
pip?: boolean | ||
stopOnUnmount?: boolean | ||
light?: boolean | string | ||
wrapper?: any | ||
onReady?: (player: ReactPlayer) => void | ||
onStart?: () => void | ||
onPlay?: () => void | ||
onPause?: () => void | ||
onBuffer?: () => void | ||
onBufferEnd?: () => void | ||
onEnded?: () => void | ||
onEnablePIP?: () => void | ||
onDisablePIP?: () => void | ||
onError?: ( error: any, data?: any, hlsInstance?: any, hlsGlobal?: any) => void | ||
onDuration?: (duration: number) => void | ||
onSeek?: (seconds: number) => void | ||
onProgress?: (state: { | ||
played: number | ||
playedSeconds: number | ||
loaded: number | ||
loadedSeconds: number | ||
}) => void | ||
[otherProps: string]: any | ||
} | ||
|
||
export default class BaseReactPlayer<T extends BaseReactPlayerProps> extends Component<T, any> { | ||
static canPlay (url: string): boolean; | ||
static canEnablePIP (url: string): boolean; | ||
static addCustomPlayer (player: ReactPlayer): void; | ||
static removeCustomPlayers (): void; | ||
seekTo (amount: number, type?: 'seconds' | 'fraction'): void; | ||
getCurrentTime (): number; | ||
getSecondsLoaded (): number; | ||
getDuration (): number; | ||
getInternalPlayer (key?: string): Record<string, any>; | ||
showPreview (): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface DailyMotionConfig { | ||
params?: Record<string, any> | ||
} | ||
|
||
export interface DailyMotionPlayerProps extends BaseReactPlayerProps { | ||
config?: DailyMotionConfig | ||
} | ||
|
||
export default class DailyMotionPlayer extends BaseReactPlayer<DailyMotionPlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface FacebookConfig { | ||
appId: string | ||
version: string | ||
playerId: string | ||
} | ||
|
||
export interface FacebookPlayerProps extends BaseReactPlayerProps { | ||
config?: FacebookConfig | ||
} | ||
|
||
export default class FacebookPlayer extends BaseReactPlayer<FacebookPlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface TrackProps { | ||
kind: string | ||
src: string | ||
srcLang: string | ||
label: string | ||
default?: boolean | ||
} | ||
|
||
export interface FileConfig { | ||
attributes?: Record<string, any> | ||
tracks?: TrackProps[] | ||
forceVideo?: boolean | ||
forceAudio?: boolean | ||
forceHLS?: boolean | ||
forceDASH?: boolean | ||
forceFLV?: boolean | ||
hlsOptions?: Record<string, any> | ||
hlsVersion?: string | ||
dashVersion?: string | ||
flvVersion?: string | ||
} | ||
|
||
export interface FilePlayerProps extends BaseReactPlayerProps { | ||
config?: FileConfig | ||
} | ||
|
||
export default class FilePlayer extends BaseReactPlayer<FilePlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
import { DailyMotionConfig } from './dailymotion' | ||
import { FacebookConfig } from './facebook' | ||
import { FileConfig } from './file' | ||
import { MixcloudConfig } from './mixcloud' | ||
import { SoundCloudConfig } from './soundcloud' | ||
import { TwitchConfig } from './twitch' | ||
import { VidyardConfig } from './vidyard' | ||
import { VimeoConfig } from './vimeo' | ||
import { WistiaConfig } from './wistia' | ||
import { YouTubeConfig } from './youtube' | ||
|
||
export interface Config { | ||
soundcloud?: SoundCloudConfig | ||
youtube?: YouTubeConfig | ||
facebook?: FacebookConfig | ||
dailymotion?: DailyMotionConfig | ||
vimeo?: VimeoConfig | ||
file?: FileConfig | ||
wistia?: WistiaConfig | ||
mixcloud?: MixcloudConfig | ||
vidyard?: VidyardConfig | ||
twitch?: TwitchConfig | ||
} | ||
|
||
export interface ReactPlayerProps extends BaseReactPlayerProps { | ||
config?: Config | ||
} | ||
|
||
export default class ReactPlayer extends BaseReactPlayer<ReactPlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface MixcloudConfig { | ||
options?: Record<string, any> | ||
} | ||
|
||
export interface MixcloudPlayerProps extends BaseReactPlayerProps { | ||
config?: MixcloudConfig | ||
} | ||
|
||
export default class MixcloudPlayer extends BaseReactPlayer<MixcloudPlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface SoundCloudConfig { | ||
options?: Record<string, any> | ||
} | ||
|
||
export interface SoundCloudPlayerProps extends BaseReactPlayerProps { | ||
config?: SoundCloudConfig | ||
} | ||
|
||
export default class SoundCloudPlayer extends BaseReactPlayer<SoundCloudPlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface StreamablePlayerProps extends BaseReactPlayerProps {} | ||
|
||
export default class StreamablePlayer extends BaseReactPlayer<StreamablePlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface TwitchConfig { | ||
options?: Record<string, any> | ||
playerId?: string | ||
} | ||
|
||
export interface TwitchPlayerProps extends BaseReactPlayerProps { | ||
config?: TwitchConfig | ||
} | ||
|
||
export default class TwitchPlayer extends BaseReactPlayer<TwitchPlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface VidyardConfig { | ||
options?: Record<string, object> | ||
} | ||
|
||
export interface VidyardPlayerProps extends BaseReactPlayerProps { | ||
config?: VidyardConfig | ||
} | ||
|
||
export default class VidyardPlayer extends BaseReactPlayer<VidyardPlayerProps> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import BaseReactPlayer, { BaseReactPlayerProps } from './base' | ||
|
||
export interface VimeoConfig { | ||
playerOptions?: Record<string, any> | ||
} | ||
|
||
export interface VimeoPlayerProps extends BaseReactPlayerProps { | ||
config?: VimeoConfig | ||
} | ||
|
||
export default class VimeoPlayer extends BaseReactPlayer<VimeoPlayerProps> {} |
Oops, something went wrong.