Skip to content

Instantly share code, notes, and snippets.

@t0yv0
Created March 20, 2013 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t0yv0/5206160 to your computer and use it in GitHub Desktop.
Save t0yv0/5206160 to your computer and use it in GitHub Desktop.
// Capture: http://docs.phonegap.com/en/2.5.0/cordova_media_capture_capture.md.html
module Capture {
interface ConfigurationData {
type: string;
height: number;
width: number;
}
interface CaptureCB {
call(mediaFiles: MediaFile[]) : void;
}
interface MediaFileData {
codecs: string;
bitrate: number;
height: number;
width: number;
duration: number;
}
interface MediaFile {
name: string;
fullPath: string;
type: string;
lastModifiedDate: Date;
size: number;
getFormatData(successCallback: (data: MediaFileData) => void, errorCallback?: () => void);
}
interface CaptureException {
code: CaptureError;
}
interface CaptureAudioOptions {
limit?: number;
duration?: number;
mode?: ConfigurationData;
}
interface CaptureImageOptions {
limit? : number;
mode?: ConfigurationData;
}
interface CaptureVideoOptions {
limit? : number;
duration?: number;
mode?: ConfigurationData;
}
interface CaptureCB {
(mediaFiles: MediaFile[]) : void;
}
interface CaptureErrorCB {
(error: CaptureException) : void;
}
}
enum CaptureError {
CAPTURE_INTERNAL_ERR,
CAPTURE_APPLICATION_BUSY,
CAPTURE_INVALID_ARGUMENT,
CAPTURE_NO_MEDIA_FILES,
CAPTURE_NOT_SUPPORTED
}
module navigator.device.capture {
var supportedAudioModes: Capture.ConfigurationData[];
var supportedImageModes: Capture.ConfigurationData[];
var supportedVideoModes: Capture.ConfigurationData[];
function captureAudio(captureSuccess: Capture.CaptureCB, captureError: Capture.CaptureError, options?: Capture.AudioOptions) {};
function captureImage(captureSuccess: Capture.CaptureCB, captureError: Capture.CaptureError, options?: Capture.ImageOptions) {};
function captureVideo(captureSuccess: Capture.CaptureCB, captureError: Capture.CaptureError, options?: Capture.VideoOptions) {};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment