UNPKG

@nodert-win10/windows.media.capture

Version:

Use the Windows.Media.Capture UWP API directly from Node.js

642 lines (466 loc) 20.4 kB
declare module "windows.media.capture" { export class Size { constructor(); } export class WhiteBalanceGain { r: Number; g: Number; b: Number; constructor(); } export class AppCaptureContract { constructor(); } export class CameraCaptureUIContract { constructor(); } export enum CameraCaptureUIMode { photoOrVideo, photo, video, } export enum CameraCaptureUIPhotoFormat { jpeg, png, jpegXR, } export enum CameraCaptureUIVideoFormat { mp4, wmv, } export enum CameraCaptureUIMaxVideoResolution { highestAvailable, lowDefinition, standardDefinition, highDefinition, } export enum CameraCaptureUIMaxPhotoResolution { highestAvailable, verySmallQvga, smallVga, mediumXga, large3M, veryLarge5M, } export enum MediaCategory { other, communications, media, gameChat, speech, } export enum MediaStreamType { videoPreview, videoRecord, audio, photo, } export enum StreamingCaptureMode { audioAndVideo, audio, video, } export enum VideoRotation { none, clockwise90Degrees, clockwise180Degrees, clockwise270Degrees, } export enum PhotoCaptureSource { auto, videoPreview, photo, } export enum VideoDeviceCharacteristic { allStreamsIndependent, previewRecordStreamsIdentical, previewPhotoStreamsIdentical, recordPhotoStreamsIdentical, allStreamsIdentical, } export enum PowerlineFrequency { disabled, fiftyHertz, sixtyHertz, } export enum MediaCaptureThermalStatus { normal, overheated, } export enum KnownVideoProfile { videoRecording, highQualityPhoto, balancedVideoAndPhoto, videoConferencing, photoSequence, } export enum AppCaptureVideoEncodingBitrateMode { custom, high, standard, } export enum AppCaptureVideoEncodingResolutionMode { custom, high, standard, } export enum AppCaptureHistoricalBufferLengthUnit { megabytes, seconds, } export class CameraCaptureUIPhotoCaptureSettings { maxResolution: CameraCaptureUIMaxPhotoResolution; format: CameraCaptureUIPhotoFormat; croppedSizeInPixels: Object; croppedAspectRatio: Object; allowCropping: Boolean; constructor(); } export class CameraCaptureUIVideoCaptureSettings { maxResolution: CameraCaptureUIMaxVideoResolution; maxDurationInSeconds: Number; format: CameraCaptureUIVideoFormat; allowTrimming: Boolean; constructor(); } export class CameraCaptureUI { photoSettings: CameraCaptureUIPhotoCaptureSettings; videoSettings: CameraCaptureUIVideoCaptureSettings; constructor(); captureFileAsync(mode: CameraCaptureUIMode, callback: (error: Error, result: Object) => void): void ; } export class AppCapture { isCapturingAudio: Boolean; isCapturingVideo: Boolean; constructor(); static getForCurrentView(): AppCapture; addListener(type: "CapturingChanged", listener: (ev: Event) => void): void ; removeListener(type: "CapturingChanged", listener: (ev: Event) => void): void ; on(type: "CapturingChanged", listener: (ev: Event) => void): void ; off(type: "CapturingChanged", listener: (ev: Event) => void): void ; addListener(type: string, listener: (ev: Event) => void): void ; removeListener(type: string, listener: (ev: Event) => void): void ; on(type: string, listener: (ev: Event) => void): void ; off(type: string, listener: (ev: Event) => void): void ; } export class MediaCaptureFailedEventArgs { code: Number; message: String; constructor(); } export class MediaCapture { audioDeviceController: Object; mediaCaptureSettings: MediaCaptureSettings; videoDeviceController: Object; cameraStreamState: Number; thermalStatus: MediaCaptureThermalStatus; constructor(); static isVideoProfileSupported(videoDeviceId: String): Boolean; static findAllVideoProfiles(videoDeviceId: String): Object; static findConcurrentProfiles(videoDeviceId: String): Object; static findKnownVideoProfiles(videoDeviceId: String, name: KnownVideoProfile): Object; getPreviewFrameAsync(callback: (error: Error, result: Object) => void): void ; getPreviewFrameAsync(destination: Object, callback: (error: Error, result: Object) => void): void ; prepareAdvancedPhotoCaptureAsync(encodingProperties: Object, callback: (error: Error, result: AdvancedPhotoCapture) => void): void ; initializeAsync(callback: (error: Error) => void): void ; initializeAsync(mediaCaptureInitializationSettings: MediaCaptureInitializationSettings, callback: (error: Error) => void): void ; startRecordToStorageFileAsync(encodingProfile: Object, file: Object, callback: (error: Error) => void): void ; startRecordToStreamAsync(encodingProfile: Object, stream: Object, callback: (error: Error) => void): void ; startRecordToCustomSinkAsync(encodingProfile: Object, customMediaSink: Object, callback: (error: Error) => void): void ; startRecordToCustomSinkAsync(encodingProfile: Object, customSinkActivationId: String, customSinkSettings: Object, callback: (error: Error) => void): void ; stopRecordAsync(callback: (error: Error) => void): void ; capturePhotoToStorageFileAsync(type: Object, file: Object, callback: (error: Error) => void): void ; capturePhotoToStreamAsync(type: Object, stream: Object, callback: (error: Error) => void): void ; addEffectAsync(mediaStreamType: MediaStreamType, effectActivationID: String, effectSettings: Object, callback: (error: Error) => void): void ; clearEffectsAsync(mediaStreamType: MediaStreamType, callback: (error: Error) => void): void ; startPreviewAsync(callback: (error: Error) => void): void ; startPreviewToCustomSinkAsync(encodingProfile: Object, customMediaSink: Object, callback: (error: Error) => void): void ; startPreviewToCustomSinkAsync(encodingProfile: Object, customSinkActivationId: String, customSinkSettings: Object, callback: (error: Error) => void): void ; stopPreviewAsync(callback: (error: Error) => void): void ; prepareLowLagRecordToStorageFileAsync(encodingProfile: Object, file: Object, callback: (error: Error, result: LowLagMediaRecording) => void): void ; prepareLowLagRecordToStreamAsync(encodingProfile: Object, stream: Object, callback: (error: Error, result: LowLagMediaRecording) => void): void ; prepareLowLagRecordToCustomSinkAsync(encodingProfile: Object, customMediaSink: Object, callback: (error: Error, result: LowLagMediaRecording) => void): void ; prepareLowLagRecordToCustomSinkAsync(encodingProfile: Object, customSinkActivationId: String, customSinkSettings: Object, callback: (error: Error, result: LowLagMediaRecording) => void): void ; prepareLowLagPhotoCaptureAsync(type: Object, callback: (error: Error, result: LowLagPhotoCapture) => void): void ; prepareLowLagPhotoSequenceCaptureAsync(type: Object, callback: (error: Error, result: LowLagPhotoSequenceCapture) => void): void ; setEncodingPropertiesAsync(mediaStreamType: MediaStreamType, mediaEncodingProperties: Object, encoderProperties: Object, callback: (error: Error) => void): void ; prepareVariablePhotoSequenceCaptureAsync(type: Object, callback: (error: Error, result: Object) => void): void ; addAudioEffectAsync(definition: Object, callback: (error: Error, result: Object) => void): void ; addVideoEffectAsync(definition: Object, mediaStreamType: MediaStreamType, callback: (error: Error, result: Object) => void): void ; pauseRecordAsync(behavior: Number, callback: (error: Error) => void): void ; resumeRecordAsync(callback: (error: Error) => void): void ; setEncoderProperty(mediaStreamType: MediaStreamType, propertyId: String, propertyValue: Object): void; getEncoderProperty(mediaStreamType: MediaStreamType, propertyId: String): Object; setPreviewMirroring(value: Boolean): void; getPreviewMirroring(): Boolean; setPreviewRotation(value: VideoRotation): void; getPreviewRotation(): VideoRotation; setRecordRotation(value: VideoRotation): void; getRecordRotation(): VideoRotation; close(): void; addListener(type: "Failed", listener: (ev: Event) => void): void ; removeListener(type: "Failed", listener: (ev: Event) => void): void ; on(type: "Failed", listener: (ev: Event) => void): void ; off(type: "Failed", listener: (ev: Event) => void): void ; addListener(type: "RecordLimitationExceeded", listener: (ev: Event) => void): void ; removeListener(type: "RecordLimitationExceeded", listener: (ev: Event) => void): void ; on(type: "RecordLimitationExceeded", listener: (ev: Event) => void): void ; off(type: "RecordLimitationExceeded", listener: (ev: Event) => void): void ; addListener(type: "FocusChanged", listener: (ev: Event) => void): void ; removeListener(type: "FocusChanged", listener: (ev: Event) => void): void ; on(type: "FocusChanged", listener: (ev: Event) => void): void ; off(type: "FocusChanged", listener: (ev: Event) => void): void ; addListener(type: "PhotoConfirmationCaptured", listener: (ev: Event) => void): void ; removeListener(type: "PhotoConfirmationCaptured", listener: (ev: Event) => void): void ; on(type: "PhotoConfirmationCaptured", listener: (ev: Event) => void): void ; off(type: "PhotoConfirmationCaptured", listener: (ev: Event) => void): void ; addListener(type: "CameraStreamStateChanged", listener: (ev: Event) => void): void ; removeListener(type: "CameraStreamStateChanged", listener: (ev: Event) => void): void ; on(type: "CameraStreamStateChanged", listener: (ev: Event) => void): void ; off(type: "CameraStreamStateChanged", listener: (ev: Event) => void): void ; addListener(type: "ThermalStatusChanged", listener: (ev: Event) => void): void ; removeListener(type: "ThermalStatusChanged", listener: (ev: Event) => void): void ; on(type: "ThermalStatusChanged", listener: (ev: Event) => void): void ; off(type: "ThermalStatusChanged", listener: (ev: Event) => void): void ; addListener(type: string, listener: (ev: Event) => void): void ; removeListener(type: string, listener: (ev: Event) => void): void ; on(type: string, listener: (ev: Event) => void): void ; off(type: string, listener: (ev: Event) => void): void ; } export class MediaCaptureVideoProfileMediaDescription { frameRate: Number; height: Number; isHdrVideoSupported: Boolean; isVariablePhotoSequenceSupported: Boolean; width: Number; constructor(); } export class MediaCaptureVideoProfile { id: String; supportedPhotoMediaDescription: Object; supportedPreviewMediaDescription: Object; supportedRecordMediaDescription: Object; videoDeviceId: String; constructor(); getConcurrency(): Object; } export class MediaCaptureInitializationSettings { videoDeviceId: String; streamingCaptureMode: StreamingCaptureMode; photoCaptureSource: PhotoCaptureSource; audioDeviceId: String; mediaCategory: MediaCategory; audioProcessing: Number; audioSource: Object; videoSource: Object; videoProfile: MediaCaptureVideoProfile; recordMediaDescription: MediaCaptureVideoProfileMediaDescription; previewMediaDescription: MediaCaptureVideoProfileMediaDescription; photoMediaDescription: MediaCaptureVideoProfileMediaDescription; constructor(); } export class MediaCaptureSettings { audioDeviceId: String; photoCaptureSource: PhotoCaptureSource; streamingCaptureMode: StreamingCaptureMode; videoDeviceCharacteristic: VideoDeviceCharacteristic; videoDeviceId: String; audioProcessing: Number; cameraSoundRequiredForRegion: Boolean; concurrentRecordAndPhotoSequenceSupported: Boolean; concurrentRecordAndPhotoSupported: Boolean; horizontal35mmEquivalentFocalLength: Number; mediaCategory: MediaCategory; pitchOffsetDegrees: Number; vertical35mmEquivalentFocalLength: Number; constructor(); } export class LowLagMediaRecording { constructor(); startAsync(callback: (error: Error) => void): void ; stopAsync(callback: (error: Error) => void): void ; finishAsync(callback: (error: Error) => void): void ; pauseAsync(behavior: Number, callback: (error: Error) => void): void ; resumeAsync(callback: (error: Error) => void): void ; } export class LowLagPhotoCapture { constructor(); captureAsync(callback: (error: Error, result: CapturedPhoto) => void): void ; finishAsync(callback: (error: Error) => void): void ; } export class LowLagPhotoSequenceCapture { constructor(); startAsync(callback: (error: Error) => void): void ; stopAsync(callback: (error: Error) => void): void ; finishAsync(callback: (error: Error) => void): void ; addListener(type: "PhotoCaptured", listener: (ev: Event) => void): void ; removeListener(type: "PhotoCaptured", listener: (ev: Event) => void): void ; on(type: "PhotoCaptured", listener: (ev: Event) => void): void ; off(type: "PhotoCaptured", listener: (ev: Event) => void): void ; addListener(type: string, listener: (ev: Event) => void): void ; removeListener(type: string, listener: (ev: Event) => void): void ; on(type: string, listener: (ev: Event) => void): void ; off(type: string, listener: (ev: Event) => void): void ; } export class MediaCaptureFocusChangedEventArgs { focusState: Number; constructor(); } export class PhotoConfirmationCapturedEventArgs { captureTimeOffset: Number; frame: CapturedFrame; constructor(); } export class AdvancedPhotoCapture { constructor(); captureAsync(callback: (error: Error, result: AdvancedCapturedPhoto) => void): void ; captureAsync(context: Object, callback: (error: Error, result: AdvancedCapturedPhoto) => void): void ; finishAsync(callback: (error: Error) => void): void ; addListener(type: "AllPhotosCaptured", listener: (ev: Event) => void): void ; removeListener(type: "AllPhotosCaptured", listener: (ev: Event) => void): void ; on(type: "AllPhotosCaptured", listener: (ev: Event) => void): void ; off(type: "AllPhotosCaptured", listener: (ev: Event) => void): void ; addListener(type: "OptionalReferencePhotoCaptured", listener: (ev: Event) => void): void ; removeListener(type: "OptionalReferencePhotoCaptured", listener: (ev: Event) => void): void ; on(type: "OptionalReferencePhotoCaptured", listener: (ev: Event) => void): void ; off(type: "OptionalReferencePhotoCaptured", listener: (ev: Event) => void): void ; addListener(type: string, listener: (ev: Event) => void): void ; removeListener(type: string, listener: (ev: Event) => void): void ; on(type: string, listener: (ev: Event) => void): void ; off(type: string, listener: (ev: Event) => void): void ; } export class CapturedPhoto { frame: CapturedFrame; thumbnail: CapturedFrame; constructor(); } export class AdvancedCapturedPhoto { context: Object; frame: CapturedFrame; mode: Number; constructor(); } export class OptionalReferencePhotoCapturedEventArgs { context: Object; frame: CapturedFrame; constructor(); } export class CapturedFrame { height: Number; width: Number; softwareBitmap: Object; contentType: String; size: Number; canRead: Boolean; canWrite: Boolean; position: Number; constructor(); readAsync(buffer: Object, count: Number, options: Number, callback: (error: Error, result: Object) => void): void ; writeAsync(buffer: Object, callback: (error: Error, result: Number) => void): void ; flushAsync(callback: (error: Error, result: Boolean) => void): void ; getInputStreamAt(position: Number): Object; getOutputStreamAt(position: Number): Object; seek(position: Number): void; cloneStream(): Object; close(): void; } export class PhotoCapturedEventArgs { captureTimeOffset: Number; frame: CapturedFrame; thumbnail: CapturedFrame; constructor(); } export class CapturedFrameControlValues { exposure: Number; exposureCompensation: Number; flashPowerPercent: Number; flashed: Boolean; focus: Number; isoSpeed: Number; sceneMode: Number; whiteBalance: Number; zoomFactor: Number; focusState: Number; isoAnalogGain: Number; isoDigitalGain: Number; sensorFrameRate: Object; whiteBalanceGain: WhiteBalanceGain; constructor(); } export class VideoStreamConfiguration { inputProperties: Object; outputProperties: Object; constructor(); } export class AppCaptureSettings { isAppCaptureEnabled: Boolean; historicalBufferLengthUnit: AppCaptureHistoricalBufferLengthUnit; historicalBufferLength: Number; isHistoricalCaptureOnWirelessDisplayAllowed: Boolean; customVideoEncodingWidth: Number; customVideoEncodingHeight: Number; customVideoEncodingBitrate: Number; audioEncodingBitrate: Number; appCaptureDestinationFolder: Object; isAudioCaptureEnabled: Boolean; videoEncodingResolutionMode: AppCaptureVideoEncodingResolutionMode; videoEncodingBitrateMode: AppCaptureVideoEncodingBitrateMode; screenshotDestinationFolder: Object; maximumRecordLength: Number; isHistoricalCaptureOnBatteryAllowed: Boolean; isHistoricalCaptureEnabled: Boolean; hasHardwareEncoder: Boolean; isCpuConstrained: Boolean; isDisabledByPolicy: Boolean; isMemoryConstrained: Boolean; alternateShortcutKeys: AppCaptureAlternateShortcutKeys; isGpuConstrained: Boolean; isMicrophoneCaptureEnabled: Boolean; constructor(); } export class AppCaptureAlternateShortcutKeys { toggleRecordingKeyModifiers: Number; toggleRecordingKey: Number; toggleRecordingIndicatorKeyModifiers: Number; toggleRecordingIndicatorKey: Number; toggleGameBarKeyModifiers: Number; toggleGameBarKey: Number; takeScreenshotKeyModifiers: Number; takeScreenshotKey: Number; saveHistoricalVideoKeyModifiers: Number; saveHistoricalVideoKey: Number; toggleMicrophoneCaptureKeyModifiers: Number; toggleMicrophoneCaptureKey: Number; constructor(); } export class AppCaptureManager { constructor(); static getCurrentSettings(): AppCaptureSettings; static applySettings(appCaptureSettings: AppCaptureSettings): void; } export class CameraOptionsUI { constructor(); static show(mediaCapture: MediaCapture): void; } export class ScreenCapture { audioSource: Object; isAudioSuspended: Boolean; isVideoSuspended: Boolean; videoSource: Object; constructor(); static getForCurrentView(): ScreenCapture; addListener(type: "SourceSuspensionChanged", listener: (ev: Event) => void): void ; removeListener(type: "SourceSuspensionChanged", listener: (ev: Event) => void): void ; on(type: "SourceSuspensionChanged", listener: (ev: Event) => void): void ; off(type: "SourceSuspensionChanged", listener: (ev: Event) => void): void ; addListener(type: string, listener: (ev: Event) => void): void ; removeListener(type: string, listener: (ev: Event) => void): void ; on(type: string, listener: (ev: Event) => void): void ; off(type: string, listener: (ev: Event) => void): void ; } export class SourceSuspensionChangedEventArgs { isAudioSuspended: Boolean; isVideoSuspended: Boolean; constructor(); } }