Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript support? #35

Open
ai-bitheads opened this issue Feb 21, 2021 · 2 comments
Open

TypeScript support? #35

ai-bitheads opened this issue Feb 21, 2021 · 2 comments

Comments

@ai-bitheads
Copy link

Are you guys planning on adding type definitions?

@K-MICK
Copy link
Collaborator

K-MICK commented Apr 6, 2021

Hello

This is something we are discussing, we will update this issue to keep you updated.

@bensalilijames
Copy link

#46 should close this, but in the meanwhile you can add this to typings/furioos-sdk.d.ts:

declare module "furioos-sdk" {
  declare type PlayerOptions = {
    whiteLabel?: boolean;
    hideToolbar?: boolean;
    hideTitle?: boolean;
    hidePlayButton?: boolean;
    overridedURL?: string;
    debugAppMode?: boolean;
    wsServerAddress?: string;
  };

  export declare class Player {
    sdkDebug?: SDKDebug;
    loaded: boolean;
    debugAppMode: boolean;
    sharedLink: string;
    containerId: string;
    embed?: HTMLIFrameElement;
    options: PlayerOptions;
    location?: string;
    private _quality;
    _onLoadCallback?: () => void;
    _onSDKMessageCallback?: (data: any) => void;
    _onUserActiveCallback?: () => void;
    _onUserInactiveCallback?: () => void;
    _onAppInstallProgress?: (value: any) => void;
    _onAppInstallSuccess?: () => void;
    _onAppInstallFail?: () => void;
    _onAppStart?: () => void;
    _onStreamStart?: () => void;
    _onSessionStoppedCallback?: () => void;
    _onStatsCallback?: (value: any) => void;
    _getServerAvailabilityErrorCallback?: (error: any) => void;
    _getServerAvailabilityCallback?: (stats: any) => void;
    _getServerMetadataErrorCallback?: (error: any) => void;
    _getServerMetadataCallback?: (metadata: any) => void;
    static qualityValues: {
      readonly AUTO: 0;
      readonly LOW: 1;
      readonly MEDIUM: 2;
      readonly HIGH: 3;
      readonly ULTRA: 4;
    };
    static regions: {
      EUW: number[];
      USW: number[];
      USE: number[];
      AUE: number[];
    };
    constructor(
      sharedLinkID: string,
      containerId: string,
      options: PlayerOptions,
    );
    _createIframe(): HTMLIFrameElement;
    _displayErrorMessage(message: string): void;
    _onLoad(): void;
    get quality(): "AUTO" | "LOW" | "MEDIUM" | "HIGH" | "ULTRA";
    onLoad(onLoadCallback: () => void): void;
    setDefaultLocation(location: string): void;
    start(location?: string): void;
    stop(): void;
    maximize(): void;
    minimize(): void;
    setQuality(value: number): void;
    restartStream(): void;
    onSDKMessage(onSDKMessageCallback: (data: any) => void): void;
    onUserActive(onUserActiveCallback: () => void): void;
    onUserInactive(onUserInactiveCallback: () => void): void;
    onAppInstallProgress(onAppInstallProgress: (value: any) => void): void;
    onAppInstallSuccess(onAppInstallSuccess: () => void): void;
    onAppInstallFail(onAppInstallFail: () => void): void;
    onAppStart(onAppStart: () => void): void;
    onStreamStart(onStreamStart: () => void): void;
    onSessionStopped(onSessionStoppedCallback: () => void): void;
    onStats(callback: (value: any) => void): void;
    sendSDKMessage(data: any): void;
    setUserActive(): void;
    setThumbnailUrl(thumbnailUrl: string): void;
    getServerAvailability(
      getServerAvailabilityCallback: (stats: any) => void,
      getServerAvailabilityErrorCallback: (error: any) => void,
    ): void;
    getServerMetadata(
      getServerMetadataCallback: (metadata: any) => void,
      getServerMetadataErrorCallback: (error: any) => void,
    ): void;
  }

  declare class SDKDebug {
    private ws;
    onReady?: () => void;
    private _onSDKMessageCallback?;
    constructor(localServerAddress: string);
    private _wsOnError;
    private _wsOnClose;
    private _wsOnMessage;
    private _wsOnSendError;
    onSDKMessage(onSDKMessageCallback: (data: any) => void): void;
    sendSDKMessage(data: any): void;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants