sdk: add canResize flag to Camera

This commit is contained in:
Koushik Dutta
2022-03-31 13:55:03 -07:00
parent b171705122
commit 4460a95f4a
5 changed files with 103 additions and 79 deletions

View File

@@ -318,14 +318,23 @@ export enum ThermostatMode {
On = "On",
}
export interface PictureDimensions {
width: number;
height: number;
width?: number;
height?: number;
}
export interface PictureOptions {
id?: string;
name?: string;
/**
* The native dimensions of the camera.
*/
picture?: PictureDimensions;
}
export interface ResponsePictureOptions extends PictureOptions {
name?: string;
/**
* Flag that indicates that the request supports resizing to custom dimensions.
*/
canResize?: boolean;
}
export interface RequestPictureOptions extends PictureOptions {
reason?: 'user' | 'event';
/**
@@ -342,8 +351,7 @@ export interface RequestPictureOptions extends PictureOptions {
*/
export interface Camera {
takePicture(options?: RequestPictureOptions): Promise<MediaObject>;
getPictureOptions(): Promise<PictureOptions[]>;
getPictureOptions(): Promise<ResponsePictureOptions[]>;
}
export interface VideoStreamOptions {
@@ -381,7 +389,7 @@ export type MediaStreamSource = "local" | "cloud";
* is requested when calling getVideoStream.
*/
export interface MediaStreamOptions {
id: string;
id?: string;
name?: string;
/**
* Prebuffer time in milliseconds.
@@ -391,30 +399,33 @@ export interface MediaStreamOptions {
* The container type of this stream, ie: mp4, mpegts, rtsp.
*/
container?: string;
/**
* The tool used to generate the container. Ie, scrypted,
* the ffmpeg tools, gstreamer.
*/
tool?: string;
video?: VideoStreamOptions;
audio?: AudioStreamOptions;
/**
* Stream specific metadata.
*/
metadata?: any;
source?: MediaStreamSource;
userConfigurable?: boolean;
/**
* The tool used to generate the container. Ie, scrypted,
* the ffmpeg tools, gstreamer.
*/
// should this be in the request too as a hint for the preferred tool to use?
tool?: string;
video?: VideoStreamOptions;
audio?: AudioStreamOptions;
}
export interface ResponseMediaStreamOptions extends MediaStreamOptions {
id: string;
/**
* The time in milliseconds that this stream must be refreshed again
* via a call to getVideoStream.
*/
refreshAt?: number;
refreshAt?: number;
source?: MediaStreamSource;
userConfigurable?: boolean;
}
export interface RequestMediaStreamOptions extends ResponseMediaStreamOptions {
@@ -686,7 +697,7 @@ export interface SoftwareUpdate {
* May optionally accept string urls if accept-url is a fromMimeType parameter.
*/
export interface BufferConverter {
convert(data: string|Buffer|any, fromMimeType: string, toMimeType: string): Promise<MediaObject|Buffer|any>;
convert(data: string | Buffer | any, fromMimeType: string, toMimeType: string): Promise<MediaObject | Buffer | any>;
fromMimeType?: string;
toMimeType?: string;
@@ -890,7 +901,7 @@ export interface MediaManager {
* Additional plugin provided convertors to consider for use when converting MediaObjects.
*/
builtinConverters: BufferConverter[];
/**
* Convert a media object to a Buffer, primtive type, or RPC Object.
*/
@@ -1357,7 +1368,7 @@ export enum ScryptedInterface {
export type RTCSignalingSendIceCandidate = (candidate: RTCIceCandidateInit) => Promise<void>;
export interface RTCSignalingSession {
createLocalDescription(type: 'offer' | 'answer', setup: RTCAVSignalingSetup, sendIceCandidate: undefined|RTCSignalingSendIceCandidate): Promise<RTCSessionDescriptionInit>;
createLocalDescription(type: 'offer' | 'answer', setup: RTCAVSignalingSetup, sendIceCandidate: undefined | RTCSignalingSendIceCandidate): Promise<RTCSessionDescriptionInit>;
setRemoteDescription(description: RTCSessionDescriptionInit, setup: RTCAVSignalingSetup): Promise<void>;
addIceCandidate(candidate: RTCIceCandidateInit): Promise<void>;
getOptions(): Promise<RTCSignalingOptions>;
@@ -1382,7 +1393,7 @@ export interface RTCSignalingOptions {
}
export interface RTCSessionControl {
getRefreshAt(): Promise<number|void>;
getRefreshAt(): Promise<number | void>;
extendSession(): Promise<void>;
endSession(): Promise<void>;
}
@@ -1401,7 +1412,7 @@ export interface RTCSignalingClient {
* strict requirements and expectations on client setup.
*/
export interface RTCSignalingChannel {
startRTCSignalingSession(session: RTCSignalingSession): Promise<RTCSessionControl|undefined>;
startRTCSignalingSession(session: RTCSignalingSession): Promise<RTCSessionControl | undefined>;
}
export interface RTCAVSignalingSetup {

View File

@@ -335,9 +335,7 @@ class MediaStreamOptions(TypedDict):
metadata: Any
name: str
prebuffer: float
source: MediaStreamSource
tool: str
userConfigurable: bool
video: VideoStreamOptions
pass
@@ -367,12 +365,6 @@ class ObjectsDetected(TypedDict):
timestamp: float
pass
class PictureOptions(TypedDict):
id: str
name: str
picture: PictureDimensions
pass
class Position(TypedDict):
accuracyRadius: float
latitude: float
@@ -404,7 +396,6 @@ class RequestMediaStreamOptions(TypedDict):
class RequestPictureOptions(TypedDict):
bulkRequest: bool
id: str
name: str
periodicRequest: bool
picture: PictureDimensions
reason: Any | Any
@@ -417,13 +408,18 @@ class RequestRecordingStreamOptions(TypedDict):
metadata: Any
name: str
prebuffer: float
source: MediaStreamSource
startTime: float
tool: str
userConfigurable: bool
video: VideoStreamOptions
pass
class ResponsePictureOptions(TypedDict):
canResize: bool
id: str
name: str
picture: PictureDimensions
pass
class ScriptSource(TypedDict):
language: str
monacoEvalDefaults: str
@@ -512,7 +508,7 @@ class BufferConverter:
pass
class Camera:
async def getPictureOptions(self) -> list[PictureOptions]:
async def getPictureOptions(self) -> list[ResponsePictureOptions]:
pass
async def takePicture(self, options: RequestPictureOptions = None) -> MediaObject:
pass

32
sdk/types/index.d.ts vendored
View File

@@ -450,14 +450,23 @@ export declare enum ThermostatMode {
On = "On"
}
export interface PictureDimensions {
width: number;
height: number;
width?: number;
height?: number;
}
export interface PictureOptions {
id?: string;
name?: string;
/**
* The native dimensions of the camera.
*/
picture?: PictureDimensions;
}
export interface ResponsePictureOptions extends PictureOptions {
name?: string;
/**
* Flag that indicates that the request supports resizing to custom dimensions.
*/
canResize?: boolean;
}
export interface RequestPictureOptions extends PictureOptions {
reason?: 'user' | 'event';
/**
@@ -474,7 +483,7 @@ export interface RequestPictureOptions extends PictureOptions {
*/
export interface Camera {
takePicture(options?: RequestPictureOptions): Promise<MediaObject>;
getPictureOptions(): Promise<PictureOptions[]>;
getPictureOptions(): Promise<ResponsePictureOptions[]>;
}
export interface VideoStreamOptions {
codec?: string;
@@ -509,7 +518,7 @@ export declare type MediaStreamSource = "local" | "cloud";
* is requested when calling getVideoStream.
*/
export interface MediaStreamOptions {
id: string;
id?: string;
name?: string;
/**
* Prebuffer time in milliseconds.
@@ -519,6 +528,10 @@ export interface MediaStreamOptions {
* The container type of this stream, ie: mp4, mpegts, rtsp.
*/
container?: string;
/**
* Stream specific metadata.
*/
metadata?: any;
/**
* The tool used to generate the container. Ie, scrypted,
* the ffmpeg tools, gstreamer.
@@ -526,19 +539,16 @@ export interface MediaStreamOptions {
tool?: string;
video?: VideoStreamOptions;
audio?: AudioStreamOptions;
/**
* Stream specific metadata.
*/
metadata?: any;
source?: MediaStreamSource;
userConfigurable?: boolean;
}
export interface ResponseMediaStreamOptions extends MediaStreamOptions {
id: string;
/**
* The time in milliseconds that this stream must be refreshed again
* via a call to getVideoStream.
*/
refreshAt?: number;
source?: MediaStreamSource;
userConfigurable?: boolean;
}
export interface RequestMediaStreamOptions extends ResponseMediaStreamOptions {
/**

View File

@@ -1015,14 +1015,23 @@ export enum ThermostatMode {
On = "On",
}
export interface PictureDimensions {
width: number;
height: number;
width?: number;
height?: number;
}
export interface PictureOptions {
id?: string;
name?: string;
/**
* The native dimensions of the camera.
*/
picture?: PictureDimensions;
}
export interface ResponsePictureOptions extends PictureOptions {
name?: string;
/**
* Flag that indicates that the request supports resizing to custom dimensions.
*/
canResize?: boolean;
}
export interface RequestPictureOptions extends PictureOptions {
reason?: 'user' | 'event';
/**
@@ -1039,8 +1048,7 @@ export interface RequestPictureOptions extends PictureOptions {
*/
export interface Camera {
takePicture(options?: RequestPictureOptions): Promise<MediaObject>;
getPictureOptions(): Promise<PictureOptions[]>;
getPictureOptions(): Promise<ResponsePictureOptions[]>;
}
export interface VideoStreamOptions {
@@ -1078,7 +1086,7 @@ export type MediaStreamSource = "local" | "cloud";
* is requested when calling getVideoStream.
*/
export interface MediaStreamOptions {
id: string;
id?: string;
name?: string;
/**
* Prebuffer time in milliseconds.
@@ -1088,30 +1096,33 @@ export interface MediaStreamOptions {
* The container type of this stream, ie: mp4, mpegts, rtsp.
*/
container?: string;
/**
* The tool used to generate the container. Ie, scrypted,
* the ffmpeg tools, gstreamer.
*/
tool?: string;
video?: VideoStreamOptions;
audio?: AudioStreamOptions;
/**
* Stream specific metadata.
*/
metadata?: any;
source?: MediaStreamSource;
userConfigurable?: boolean;
/**
* The tool used to generate the container. Ie, scrypted,
* the ffmpeg tools, gstreamer.
*/
// should this be in the request too as a hint for the preferred tool to use?
tool?: string;
video?: VideoStreamOptions;
audio?: AudioStreamOptions;
}
export interface ResponseMediaStreamOptions extends MediaStreamOptions {
id: string;
/**
* The time in milliseconds that this stream must be refreshed again
* via a call to getVideoStream.
*/
refreshAt?: number;
refreshAt?: number;
source?: MediaStreamSource;
userConfigurable?: boolean;
}
export interface RequestMediaStreamOptions extends ResponseMediaStreamOptions {
@@ -1383,7 +1394,7 @@ export interface SoftwareUpdate {
* May optionally accept string urls if accept-url is a fromMimeType parameter.
*/
export interface BufferConverter {
convert(data: string|Buffer|any, fromMimeType: string, toMimeType: string): Promise<MediaObject|Buffer|any>;
convert(data: string | Buffer | any, fromMimeType: string, toMimeType: string): Promise<MediaObject | Buffer | any>;
fromMimeType?: string;
toMimeType?: string;
@@ -1587,7 +1598,7 @@ export interface MediaManager {
* Additional plugin provided convertors to consider for use when converting MediaObjects.
*/
builtinConverters: BufferConverter[];
/**
* Convert a media object to a Buffer, primtive type, or RPC Object.
*/
@@ -2054,7 +2065,7 @@ export enum ScryptedInterface {
export type RTCSignalingSendIceCandidate = (candidate: RTCIceCandidateInit) => Promise<void>;
export interface RTCSignalingSession {
createLocalDescription(type: 'offer' | 'answer', setup: RTCAVSignalingSetup, sendIceCandidate: undefined|RTCSignalingSendIceCandidate): Promise<RTCSessionDescriptionInit>;
createLocalDescription(type: 'offer' | 'answer', setup: RTCAVSignalingSetup, sendIceCandidate: undefined | RTCSignalingSendIceCandidate): Promise<RTCSessionDescriptionInit>;
setRemoteDescription(description: RTCSessionDescriptionInit, setup: RTCAVSignalingSetup): Promise<void>;
addIceCandidate(candidate: RTCIceCandidateInit): Promise<void>;
getOptions(): Promise<RTCSignalingOptions>;
@@ -2079,7 +2090,7 @@ export interface RTCSignalingOptions {
}
export interface RTCSessionControl {
getRefreshAt(): Promise<number|void>;
getRefreshAt(): Promise<number | void>;
extendSession(): Promise<void>;
endSession(): Promise<void>;
}
@@ -2098,7 +2109,7 @@ export interface RTCSignalingClient {
* strict requirements and expectations on client setup.
*/
export interface RTCSignalingChannel {
startRTCSignalingSession(session: RTCSignalingSession): Promise<RTCSessionControl|undefined>;
startRTCSignalingSession(session: RTCSignalingSession): Promise<RTCSessionControl | undefined>;
}
export interface RTCAVSignalingSetup {

View File

@@ -335,9 +335,7 @@ class MediaStreamOptions(TypedDict):
metadata: Any
name: str
prebuffer: float
source: MediaStreamSource
tool: str
userConfigurable: bool
video: VideoStreamOptions
pass
@@ -367,12 +365,6 @@ class ObjectsDetected(TypedDict):
timestamp: float
pass
class PictureOptions(TypedDict):
id: str
name: str
picture: PictureDimensions
pass
class Position(TypedDict):
accuracyRadius: float
latitude: float
@@ -404,7 +396,6 @@ class RequestMediaStreamOptions(TypedDict):
class RequestPictureOptions(TypedDict):
bulkRequest: bool
id: str
name: str
periodicRequest: bool
picture: PictureDimensions
reason: Any | Any
@@ -417,13 +408,18 @@ class RequestRecordingStreamOptions(TypedDict):
metadata: Any
name: str
prebuffer: float
source: MediaStreamSource
startTime: float
tool: str
userConfigurable: bool
video: VideoStreamOptions
pass
class ResponsePictureOptions(TypedDict):
canResize: bool
id: str
name: str
picture: PictureDimensions
pass
class ScriptSource(TypedDict):
language: str
monacoEvalDefaults: str
@@ -512,7 +508,7 @@ class BufferConverter:
pass
class Camera:
async def getPictureOptions(self) -> list[PictureOptions]:
async def getPictureOptions(self) -> list[ResponsePictureOptions]:
pass
async def takePicture(self, options: RequestPictureOptions = None) -> MediaObject:
pass