import { IFrameData, RawFrame } from "../media/RawFrame";
import { SLogger } from "../network/Helper";
/**Internal use only.
 * Bundles all functionality related to MediaStream, Tracks and video processing.
 * It creates two HTML elements: Video and Canvas to interact with the video stream
 * and convert the visible frame data to Uint8Array for compatibility with the
 * unity plugin and all other platforms.
 *
 */
export declare class BrowserMediaStream {
    static DEBUG_SHOW_ELEMENTS: boolean;
    static sNextInstanceId: number;
    static VERBOSE: boolean;
    private mStream;
    get Stream(): MediaStream;
    private mLocal;
    private mCurrentFrame;
    private mInstanceId;
    private mIdentity;
    private mVideoElement;
    get VideoElement(): HTMLVideoElement;
    private mCanvasElement;
    private mIsActive;
    private mAudioProcessor;
    static DEFAULT_FRAMERATE: number;
    private mMsPerFrame;
    private mFrameEventMethod;
    private mDefaultVolume;
    private mLastFrameTime;
    private mNextFrameTime;
    /** Number of the last frame (not yet supported in all browsers)
     * if it remains at <= 0 then we just generate frames based on
     * the timer above
     */
    private mLastFrameNumber;
    private mHasVideo;
    private log;
    InternalStreamAdded: (stream: BrowserMediaStream) => void;
    /**If previously play triggered an error the AutoplayResolver can
     * attempt to play again after the user interacted with the webpage.
     *
     * Mostly used on iOS Safari. This feature is error prone and can only
     * be manually tested keep log verbose!
     */
    ResolveAutoplay(): void;
    constructor(isLocal: boolean, baseLogger?: SLogger);
    /**Adds or replaces a track with a new track of the same kind
     *
     * @param new_track Track to add / replace the current track with
     */
    UpdateTrack(new_track: MediaStreamTrack): void;
    /**Removes a track from the Stream.
     *
     * @param track track to remove
     */
    RemoveTrack(track: MediaStreamTrack): void;
    /**
     * This resets the srcObject property of the VideoElement.
     * Used to force a clean reload after removing a track
     * (Chrome single negotiation workaround)
     */
    ResetObject(): void;
    /**Tries to determine a good video framerate.
     * 1. Either the browser returns exact frame numbers via webkitDecodedFrameCount
     * 2. or it might have a property frameRate (likely only available for local video)
     * 3. if all fails we use DEFAULT_FRAMERATE as a fallback
     */
    private DetermineFrameEventMethod;
    private UpdateAudioProcessing;
    /**
     * Called when meta data first becomes available or when tracks are changed.
     * Might trigger several times in the row e.g. first a track might be available but width/height unknown
     * until onloadmetadata triggers and calls it again.
     *
     * If video is available this checks the current framerate and creates a canvas
     * used to process frames.
     * If video is unavailable it destroys the canvas.
     *
     *
     */
    private UpdateVideoProcessing;
    private TriggerAutoplayBlockled;
    private TryPlay;
    private SetupElements;
    /** Returns the current frame number.
     *  Treat a return value of 0 or smaller as unknown.
     * (Browsers might have the property but
     * always return 0)
     */
    private GetFrameNumber;
    TryGetFrame(): IFrameData;
    SetMute(mute: boolean): void;
    PeekFrame(): IFrameData;
    /** Ensures we have the latest frame ready
     * for the next PeekFrame / TryGetFrame calls
     */
    private EnsureLatestFrame;
    /** checks if the html tag has a newer frame available
     * (or if 1/30th of a second passed since last frame if
     * this info isn't available)
     */
    private HasNewerFrame;
    Update(): void;
    private DestroyCanvas;
    private DestroyVideoElement;
    Dispose(): void;
    CreateFrame(): RawFrame;
    private GenerateFrame;
    private SetupVideoElement;
    private SetupCanvas;
    SetVolume(volume: number): void;
    SetVolumePan(volume: number, pan: number): void;
    /**
     * @returns true if a audio track is attached to the stream, false if not
     */
    HasAudioTrack(): boolean;
    /**
     * @returns true if a video track is attached to the stream, false it not
     */
    HasVideoTrack(): boolean;
    /**
     *
     * @returns the used audio track or null if none
     */
    GetAudioTrack(): MediaStreamTrack;
    /**
     * @returns the used video track or null if none
     */
    GetVideoTrack(): MediaStreamTrack;
}
