/** * @hidden * Extended video API * @internal * Limited to Microsoft-internal use * @beta * @module */ import { DefaultVideoEffectCallBack as VideoEffectCallBack } from '../internal/videoEffectsUtils'; import * as videoEffects from '../public/videoEffects'; export declare const frameProcessingTimeoutInMs = 2000; /** * @hidden * Error level when notifying errors to the host, the host will decide what to do acording to the error level. * @beta * * @internal * Limited to Microsoft-internal use */ export declare enum ErrorLevel { Fatal = "fatal", Warn = "warn" } /** * @hidden * Video frame configuration supplied to the host to customize the generated video frame parameters * @beta * * @internal * Limited to Microsoft-internal use */ export interface VideoFrameConfig extends videoEffects.VideoFrameConfig { /** * @hidden * Flag to indicate use camera stream to synthesize video frame or not. * Default value is true. * @beta * * @internal * Limited to Microsoft-internal use */ requireCameraStream?: boolean; /** * @hidden * Machine learning model to run in the host to do audio inference for you * @beta * * @internal * Limited to Microsoft-internal use */ audioInferenceModel?: ArrayBuffer; /** * @hidden * Specifies additional capabilities that should be applied to the video frame * @beta * * @internal * Limited to Microsoft-internal use */ requiredCapabilities?: string[]; } /** * @hidden * Represents a video frame * @beta * * @internal * Limited to Microsoft-internal use */ export interface VideoBufferData extends videoEffects.VideoBufferData { /** * @hidden * The model output if you passed in an {@linkcode VideoFrameConfig.audioInferenceModel} * @beta * * @internal * Limited to Microsoft-internal use */ audioInferenceResult?: Uint8Array; } /** * @hidden * The callback will be called on every frame when running on the supported host. * We require the frame rate of the video to be at least 22fps for 720p, thus the callback should process a frame timely. * The video app should call `notifyVideoFrameProcessed` to notify a successfully processed video frame. * The video app should call `notifyError` to notify a failure. When the failures accumulate to a certain number(determined by the host), the host will see the app is "frozen" and give the user the option to close the app. * @beta * * @internal * Limited to Microsoft-internal use */ export type VideoBufferHandler = (videoBufferData: VideoBufferData, notifyVideoFrameProcessed: () => void, notifyError: (errorMessage: string) => void) => void; /** * @hidden * Video frame data extracted from the media stream. More properties may be added in the future. * @beta * * @internal * Limited to Microsoft-internal use */ export type VideoFrameData = videoEffects.VideoFrameData & { /** * @hidden * The model output if you passed in an {@linkcode VideoFrameConfig.audioInferenceModel} * @beta * * @internal * Limited to Microsoft-internal use */ audioInferenceResult?: Uint8Array; /** * @hidden * Additional metadata determined by capabilities specified in {@linkcode VideoFrameConfig.requiredCapabilities} * @beta * * @internal * Limited to Microsoft-internal use */ attributes?: ReadonlyMap; }; /** * @hidden * The callback will be called on every frame when running on the supported host. * We require the frame rate of the video to be at least 22fps for 720p, thus the callback should process a frame timely. * The video app should resolve the promise to notify a successfully processed video frame. * The video app should reject the promise to notify a failure. When the failures accumulate to a certain number(determined by the host), the host will see the app is "frozen" and give the user the option to close the app. * @beta * * @internal * Limited to Microsoft-internal use */ export type VideoFrameHandler = (receivedVideoFrame: VideoFrameData) => Promise; /** * @hidden * @beta * Callbacks and configuration supplied to the host to process the video frames. * @internal * Limited to Microsoft-internal use */ export type RegisterForVideoFrameParameters = { /** * Callback function to process the video frames extracted from a media stream. */ videoFrameHandler: VideoFrameHandler; /** * Callback function to process the video frames shared by the host. */ videoBufferHandler: VideoBufferHandler; /** * Video frame configuration supplied to the host to customize the generated video frame parameters, like format */ config: VideoFrameConfig; }; /** * @hidden * Register to process video frames * @beta * * @param parameters - Callbacks and configuration to process the video frames. A host may support either {@link VideoFrameHandler} or {@link VideoBufferHandler}, but not both. * To ensure the video effect works on all supported hosts, the video app must provide both {@link VideoFrameHandler} and {@link VideoBufferHandler}. * The host will choose the appropriate callback based on the host's capability. * * @internal * Limited to Microsoft-internal use */ export declare function registerForVideoFrame(parameters: RegisterForVideoFrameParameters): void; /** * @hidden * Video extension should call this to notify host that the current selected effect parameter changed. * If it's pre-meeting, host will call videoEffectCallback immediately then use the videoEffect. * If it's the in-meeting scenario, we will call videoEffectCallback when apply button clicked. * @beta * @param effectChangeType - the effect change type. * @param effectId - Newly selected effect id. {@linkcode VideoEffectCallBack} * @param effectParam Variant for the newly selected effect. {@linkcode VideoEffectCallBack} * * @internal * Limited to Microsoft-internal use */ export declare function notifySelectedVideoEffectChanged(effectChangeType: videoEffects.EffectChangeType, effectId: string | undefined, effectParam?: string): void; /** * @hidden * Register the video effect callback, host uses this to notify the video extension the new video effect will by applied * @beta * @param callback - The VideoEffectCallback to invoke when registerForVideoEffect has completed * * @internal * Limited to Microsoft-internal use */ export declare function registerForVideoEffect(callback: VideoEffectCallBack): void; /** * @hidden * Personalized video effect * @beta * * @internal * Limited to Microsoft-internal use */ export interface PersonalizedEffect { /** * Personalized effect id */ id: string; /** * Display name */ name: string; /** * Effect type defined by app */ type: string; /** * Data URI of the thumbnail image content encoded in ASCII format using the base64 scheme */ thumbnail: string; } /** * @hidden * Send personalized effects to Teams client * @beta * * @internal * Limited to Microsoft-internal use */ export declare function updatePersonalizedEffects(effects: PersonalizedEffect[]): void; /** * @hidden * * Checks if video capability is supported by the host * @beta * * @throws Error if {@linkcode app.initialize} has not successfully completed * * @returns boolean to represent whether the video capability is supported * * @internal * Limited to Microsoft-internal use */ export declare function isSupported(): boolean; /** * @hidden * Sending fatal error notification to host. Call this function only when your app meets fatal error and can't continue. * The host will stop the video pipeline and terminate this session, and optionally, show an error message to the user. * @beta * @param errorMessage - The error message that will be sent to the host * * @internal * Limited to Microsoft-internal use */ export declare function notifyFatalError(errorMessage: string): void;