import Vnmf from '../../index' declare module '../../index' { namespace saveVideoToPhotosAlbum { interface Option { /** Video File Path,It could be a temporary file path or permanent path. */ filePath: string /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } } namespace openVideoEditor { interface Option { /** Path to video source,Only local paths are supported */ filePath: string /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Duration of video files generated after editing,milliseconds(ms) */ duration: number /** Size of video files generated after editing,Bytes(byte) */ size: number /** Temporary path for edited video files */ tempFilePath: string /** Temporary path to the edited thumbnail file */ tempThumbPath: string } } namespace getVideoInfo { interface Option { /** Video File Path,It could be a temporary file path or permanent path. */ src: string /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Direction of the image */ orientation: keyof Orientation /** Video Format */ type: string /** Video Length */ duration: number /** Video Size,Units kB */ size: number /** The length of the video.,Units px */ height: number /** Width of the video,Units px */ width: number /** Video Frame Rate */ fps: number /** Video Code Rate,Units kbps */ bitrate: number } interface Orientation { /** Default */ up /** 180 Rotation */ down /** Rotate Counterclockwise 90 degrees */ left /** Rotate Clockwise 90 degrees */ right /** Same. up,But flip horizontally. */ 'up-mirrored' /** Same. down,But flip horizontally. */ 'down-mirrored' /** Same. left,But flipped vertically. */ 'left-mirrored' /** Same. right,But flipped vertically. */ 'right-mirrored' } } /** VideoContext Example,Through [Vnmf.createVideoContext](./createVideoContext) Fetch。 * * VideoContext Through id With one. video Component binding,Operation corresponds to video Component。 * @supported weapp, h5, rn * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html */ interface VideoContext { /** Quit background audio mode。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitBackgroundPlayback.html */ exitBackgroundPlayback(): void /** Exit Full Screen * @supported weapp, h5, rn * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html */ exitFullScreen(): void /** Quit the window.,This method can be called on any page * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitPictureInPicture.html */ exitPictureInPicture(option: VideoContext.ExitPictureInPictureOption): void /** Hide Status Bar,Just...iOSFull screen valid. * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.hideStatusBar.html */ hideStatusBar(): void /** Pause Video * @supported weapp, h5, rn * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html */ pause(): void /** Play Video * @supported weapp, h5, rn * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html */ play(): void /** Set Quick Play * @supported weapp, h5, rn * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html */ playbackRate( /** Multiplier,Support 0.5/0.8/1.0/1.25/1.5,2.6.3 Stand by. 2.0 Speed */ rate: number, ): void /** Enter backstage audio mode。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestBackgroundPlayback.html */ requestBackgroundPlayback(): void /** Enter full screen * @supported weapp, h5, rn * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html */ requestFullScreen(option: VideoContext.RequestFullScreenOption): void /** Jump to Assigned Location * @supported weapp, h5, rn * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html */ seek( /** Jump to Location,Units s */ position: number, ): void /** Send the screen. * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.sendDanmu.html */ sendDanmu( /** The contents of the screen. */ data: VideoContext.Danmu, ): void /** Show the status bar,Just...iOSFull screen valid. * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.showStatusBar.html */ showStatusBar(): void /** Stop Video * @supported weapp, h5, rn * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html */ stop(): void } namespace VideoContext { interface ExitPictureInPictureOption { /** Interface calls a successful echo function */ success?: (result: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void } interface RequestFullScreenOption { /** Set the direction of full-screen video,If you don't specify, you're judged automatically by the width ratio.。 * * Optional value: * - 0: Normal vertical; * - 90: Screen Counterclockwise90degrees; * - -90: Screen Clockwise90degrees; */ direction?: 0 | 90 | -90 } /** The contents of the screen. */ interface Danmu { /** Curtain Text */ text: string /** Curtain Colour */ color?: string } } namespace compressVideo { interface Option { /** Video File Path,It could be a temporary file path or permanent path. */ src: string /** Compress mass */ quality: keyof Quality /** Code rate,Units kbps */ bitrate: number /** Frame Rate */ fps: number /** Resolution ratio to original video,Value Range(0, 1] */ resolution: number /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Compressed temporary file address */ tempFilePath: string /** The size of the compressed,Units kB */ size: number } interface Quality { /** Low */ low /** Medium */ medium /** High */ high } } namespace chooseVideo { interface Option { /** By default, it's the front or back of camera.。Part Android The phone's under the system. ROM Not supported. effective. */ camera?: keyof Camera /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Can not delete folder: %s: No such folder */ compressed?: boolean /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** The maximum time you can get a video.,Unit seconds */ maxDuration?: number /** Source of video selection */ sourceType?: Array /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Time length of the selected video */ duration: number /** Returns the height of selected video */ height: number /** The size of the data selected video */ size: number /** Select a temporary file path for the video */ tempFilePath: string /** Returns the width of selected video */ width: number /** Call Results */ errMsg: string } interface Camera { /** By default, pull up after the camera */ back /** By default, pull up the pre-cam camera */ front } interface sourceType { /** Select a video from an album */ album /** Take video with a camera */ camera } } namespace chooseMedia { interface Option { /** Maximum number of files to select */ count?: number /** File type */ mediaType?: Array /** Source of image and video selection */ sourceType?: Array /** The maximum time you can get a video.,Unit seconds。Time frame is 3s to 30s Between */ maxDuration?: number /** Just right. mediaType Yes. image _Other Organiser,Can not delete folder: %s: No such folder */ sizeType?: Array<'original' | 'compressed'> /** Just... sourceType Yes. camera Effective from time to date,Use pre- or post-cam cameras */ camera?: string /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Local Temporary File List */ tempFiles: ChooseMedia[] /** File type,Valid value yes image 、video */ type: string } /** Local Temporary File List */ interface ChooseMedia { /** Local Temporary File Path (Local Path) */ tempFilePath: string /** Local Temporary File Size,Units B */ size: number /** Time length of the video */ duration: number /** The height of the video */ height: number /** Width of the video */ width: number /** Video Thumbnails Temporary File Path */ thumbTempFilePath: string } interface mediaType { /** Only video can be taken or selected from an album */ video /** Only pictures can be taken or selected from albums */ image } interface sourceType { /** Select from Album */ album /** Use camera to film */ camera } interface camera { /** Use the back of camera */ back /** Use pre-cam */ front } } interface VnmfStatic { /** * Save Video to System Album。Supportmp4Video Format。Yes.[User Permissions](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum * * **Bug & Tip:** * * 1. `tip`: camera Parameters in Part Android The phone's under the system. ROM Not supported. effective. * @supported weapp, rn * @example ```tsx * Vnmf.saveVideoToPhotosAlbum({ * filePath: 'wxfile://xxx', * success: function (res) { * console.log(res.errMsg) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html */ saveVideoToPhotosAlbum(option: saveVideoToPhotosAlbum.Option): Promise /** Open Video Editor * @supported weapp * @example * ```tsx * Vnmf.openVideoEditor({ * filePath: '' * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.openVideoEditor.html */ openVideoEditor(option: openVideoEditor.Option): Promise /** Get Video Details * @supported weapp * @example * ```tsx * Vnmf.downloadFile({ * url: 'https://mock.vnmf.org/mock_video.mp4', * success(res) { * Vnmf.getVideoInfo({ * src: res.tempFilePath, * success (res) { * console.log('Could not close temporary folder: %s') * console.log(res) * }, * fail (res) { * console.log('Could not close temporary folder: %s') * console.log(res) * }, * complete (res) { * console.log('Fetch File Address') * } * }) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html */ getVideoInfo(option: getVideoInfo.Option): Promise /** Create video Context VideoContext Object。 * @supported weapp, h5, rn * @example * ```tsx * videoContext = Vnmf.createVideoContext('myVideo') * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.createVideoContext.html */ createVideoContext( /** video Component id */ id: string, /** Under Custom Components,Examples of the current componentthis,To operate inside the component video Component */ component?: VnmfGeneral.IAnyObject, ): VideoContext /** Compressed Video Interface。 * Developer can specify compression mass `quality` Compress。When it takes more precision to control.,Assignable `bitrate`、`fps`、and `resolution`,♪ When `quality` _Other Organiser,The three parameters will be ignored.。Relevant information about the original video can be accessed [getVideoInfo](/docs/apis/media/video/getVideoInfo) Fetch。 * @supported weapp * @example * ```tsx * Vnmf.chooseVideo({ * sourceType: ['album', 'camera'], * maxDuration: 60, * camera: 'back', * compressed: false, * success (res) { * Vnmf.compressVideo({ * src: res.tempFilePath, * quality: quality, * bitrate: 1032, * fps: 24, * resolution:0.5, * success (res) { * console.log("Compressed successfully") * }, * fail (err) { * console.log("Compression failed") * } * }) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.compressVideo.html */ compressVideo(option: compressVideo.Option): Promise /** Take a video or select from cell phone album。 * @supported weapp, rn * @example * ```tsx * Vnmf.chooseVideo({ * sourceType: ['album','camera'], * maxDuration: 60, * camera: 'back', * success: function (res) { * console.log(res.tempFilePath) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html */ chooseVideo(option: chooseVideo.Option): Promise /** Take or select a picture video from cell phone album。 * @supported weapp * @example * ```tsx * Vnmf.chooseMedia({ * count: 9, * mediaType: ['image','video'], * sourceType: ['album', 'camera'], * maxDuration: 30, * camera: 'back', * success: (res) => { * console.log(res.tempFiles) * console.log(res.type) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html */ chooseMedia(option: chooseMedia.Option): Promise } }