import Vnmf from '../../index' declare module '../../index' { namespace stopVoice { interface Option { /** 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 setInnerAudioOption { interface Option { /** 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 /** Whether to mix with other audio,Set As true After,Do not terminate other applications or music in micromail */ mixWithOther?: boolean /** (Just... iOS Entry into force)Whether to follow the silent switch,Set As false After,Even in silent mode.,You can play the sound too. */ obeyMuteSwitch?: boolean /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } } namespace playVoice { interface Option { /** File path for voice files to play */ filePath: string /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Specifies the duration of recording,The recording will stop automatically when it reaches the specified length of time.,Units:sec */ duration?: number /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } } namespace pauseVoice { interface Option { /** 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 getAvailableAudioSources { interface Option { /** 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?: (result: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** List of supported audio input sources,Yes. [RecorderManager.start()](/docs/apis/media/recorder/RecorderManager#start)Use。Return value definition reference https://developer.android.com/reference/kotlin/android/media/MediaRecorder.AudioSource */ audioSources: Array /** Call Results */ errMsg: string } /** Supported audio input source */ interface audioSources { /** Auto Settings,Default use of mobile microphones,Automatically switch to headphone microphones when plugged in with an earr.,Apply to all platforms */ 'auto' /** Cellphone mics.,Limited iOS */ 'buildInMic' /** Headphone microphone.,Limited iOS */ 'headsetMic' /** Microphone(It's a mobile microphone when you're not in your ear.,It's a headphone microphone when you plug your ear.),Limited Android */ 'mic' /** Same. mic,For recording video content,Limited Android */ 'camcorder' /** Same. mic,For real-time communication,Limited Android */ 'voice_communication' /** Same. mic,It's for voice recognition.,Limited Android */ 'voice_recognition' } } /** AudioBuffer Interface means there's a small amount of audio resources in memory.,Utilization [WebAudioContext.decodeAudioData](./WebAudioContext#decodeaudiodata) Build method from an audio file,Or use it. [AudioContext.createBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/(AudioContext.createBuffer).html) Build From Original Data。Put the audio in. AudioBuffer After,It can be passed on to one. AudioBufferSourceNode Play。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html */ interface AudioBuffer { /** Store in cachePCMData sampling rate(Unitssample/s) */ sampleRate: number /** Returns storage in cachePCMSample frame rate of data */ length: number /** Returns storage in cachePCMData duration(in seconds) */ duration: number /** Storage in the cachePCMNumber of Channels Data */ numberOfChannels: number /** returns one Float32Array,It's got a channel in it.PCMData,Defined by Channel Parameters(Yes.0For the first channel.) * @supported weapp * @example * ```tsx * const audioCtx = Vnmf.createWebAudioContext() * const myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate); * const nowBuffering = myArrayBuffer.getChannelData(channel); * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.getChannelData.html */ getChannelData(channel: number): Float32Array /** From AudioBuffer , copy the specified channel to array terminal。 * @supported weapp * @example * ```tsx * const audioCtx = Vnmf.createWebAudioContext() * const audioBuffer = audioCtx.createFromAudioFile({ * filePath:'/pages/res/bgm.mp3', // Static resources * mixToMono:true, * sampleRate:44100 * }); * const channels = audioBuffer.numberOfChannels * const anotherArray = new Float32Array(frameCount); * const rate = audioBuffer.sampleRate * const startOffSet = 0 * const endOffset = rate * 3; * const newAudioBuffer = audioCtx.createBuffer(channels,endOffset - startOffset,rate) * const offset = 0 * * for (let channel = 0; channel < channels; channel++) { * audioBuffer.copyFromChannel(anotherArray, channel, startOffset); * newAudioBuffer.copyToChannel(anotherArray, channel, offset); * } * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.copyFromChannel.html */ copyFromChannel(): void /** Copy the sample from specified array to audioBuffer ♪ A particular passageway * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.copyToChannel.html */ copyToChannel( /** Source array to copy */ source: Float32Array, /** Could not close temporary folder: %s */ channelNumber: number, /** Copy Offset Data Volume */ startInChannel: number ): void } /** `AudioContext` Example,Through `Vnmf.createAudioContext` Fetch。 * * `AudioContext` Through `id` With one. `audio` Component binding,Operation corresponds to audio Component。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html */ interface AudioContext { /** Pause Audio。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.pause.html */ pause(): void /** Play Audio。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.play.html */ play(): void /** Jump to Assigned Location。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.seek.html */ seek( /** Jump to Position,Units s */ position: number, ): void /** Set Audio Address * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.setSrc.html */ setSrc( /** Audio Address */ src: string, ): void } /** InnerAudioContext Example,Through [Vnmf.createInnerAudioContext](./createInnerAudioContext) Interface capture instance。 * * **Support Format** * * | Format | iOS | Android | * | ---- | ---- | ------- | * | flac | x | √ | * | m4a | √ | √ | * | ogg | x | √ | * | ape | x | √ | * | amr | x | √ | * | wma | x | √ | * | wav | √ | √ | * | mp3 | √ | √ | * | mp4 | x | √ | * | aac | √ | √ | * | aiff | √ | x | * | caf | √ | x | * @example * ```tsx * const innerAudioContext = Vnmf.createInnerAudioContext() * innerAudioContext.autoplay = true * innerAudioContext.src = 'https://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' * innerAudioContext.onPlay(() => { * console.log('Start playing') * }) * innerAudioContext.onError((res) => { * console.log(res.errMsg) * console.log(res.errCode) * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html */ interface InnerAudioContext { /** Cannot initialise Evolution's mail component.,Used for Direct Play。 */ src: string /** Place to start playing(Units:s) * @default 0 */ startTime: number /** Whether to start playing automatically * @default false */ autoplay: boolean /** Whether or not to play the playback * @default false */ loop: boolean /** Whether to follow system silence switch。When this parameter is `false` Hour,Even if the user turns on silent switch,,I can still make a sound.。From 2.3.0 Version starts without this parameter,Use [Vnmf.setInnerAudioOption](/docs/apis/media/audio/setInnerAudioOption) Interface unified settings。 * @default true */ obeyMuteSwitch: boolean /** Volume。Scope 0~1。 * @default 1 */ volume: number /** Play speed。Scope 0.5-2.0。 * @default 1 */ playbackRate: number /** Length of current audio(Units s)。It's the only thing that's legal right now. src Back on time. * @readonly */ duration: number /** Current audio playing position(Units s)。It's the only thing that's legal right now. src Back on time.,♪ Time to keep decimals 6 bits * @readonly */ currentTime: number /** Whether or not to suspend status at present * @readonly */ paused: boolean /** Audio buffer time point,Only ensure that the current playtime to this time point is buffered * @readonly */ buffered: number /** origin: Send Full referrer; no-referrer: Do Not Send */ referrerPolicy?: 'origin' | 'no-referrer' | string /** Play * @supported weapp, h5, rn */ play(): void /** Pause * @supported weapp, h5, rn */ pause(): void /** Stop * @supported weapp, h5, rn */ stop(): void /** Jump to Assigned Location,Units s * @supported weapp, h5, rn */ seek(position: number): void /** Destruction of the current example * @supported weapp, h5 */ destroy(): void /** Audio access to playable status,But there's no guarantee we'll be able to play in the back. * @supported weapp, h5, rn */ onCanplay(callback?: () => void): void /** Audio Play Events * @supported weapp, h5, rn */ onPlay(callback?: () => void): void /** Audio Pause Event * @supported weapp, h5, rn */ onPause(callback?: () => void): void /** Audio Stop Event * @supported weapp, h5, rn */ onStop(callback?: () => void): void /** Audio Play-Absolute End Event * @supported weapp, h5, rn */ onEnded(callback?: () => void): void /** Audio play progress update event * @supported weapp, h5, rn */ onTimeUpdate(callback?: () => void): void /** Audio Play Error * @supported weapp, h5, rn */ onError(callback?: (res: InnerAudioContext.onErrorDetail) => void): void /** Audio Loading Events,When audio is not enough because of the data,It triggers when you need to stop loading. * @supported weapp, h5, rn */ onWaiting(callback?: () => void): void /** Audio performance seek Operation event * @supported weapp, h5, rn */ onSeeking(callback?: () => void): void /** Audio complete seek Operation event * @supported weapp, h5, rn */ onSeeked(callback?: () => void): void /** Disable listening. onCanplay Events * @supported weapp, h5, rn */ offCanplay(callback?: () => void): void /** Disable listening. onPlay Events * @supported weapp, h5, rn */ offPlay(callback?: () => void): void /** Disable listening. onPause Events * @supported weapp, h5, rn */ offPause(callback?: () => void): void /** Disable listening. onStop Events * @supported weapp, h5, rn */ offStop(callback?: () => void): void /** Disable listening. onEnded Events * @supported weapp, h5, rn */ offEnded(callback?: () => void): void /** Disable listening. onTimeUpdate Events * @supported weapp, h5, rn */ offTimeUpdate(callback?: () => void): void /** Disable listening. onError Events * @supported weapp, h5, rn */ offError(callback?: () => void): void /** Disable listening. onWaiting Events * @supported weapp, h5, rn */ offWaiting(callback?: () => void): void /** Disable listening. onSeeking Events * @supported weapp, h5, rn */ offSeeking(callback?: () => void): void /** Disable listening. onSeeked Events * @supported weapp, h5, rn */ offSeeked(callback?: () => void): void } namespace InnerAudioContext { interface onErrorDetail extends VnmfGeneral.CallbackResult { /** Error Code */ errCode: number /** Cannot initialise Evolution's mail component. */ errMsg: string } interface onErrorDetailErrCode { /** System Error */ 10001 /** Network Error */ 10002 /** File Error */ 10003 /** Format Error */ 10004 /** Unknown error */ '-1' } } /** MediaAudioPlayer Example,Through [Vnmf.createMediaAudioPlayer](./createMediaAudioPlayer) Interface capture instance。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.html */ interface MediaAudioPlayer { /** Volume。Scope 0~1 * @default 1 */ volume: number /** Activate Player * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.start.html */ start(): Promise /** Add Audio Source * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.addAudioSource.html */ addAudioSource( /** Examples of video decoder。Add to Audio Player as Source */ source: VideoDecoder ): Promise /** Remove Audio Source * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.removeAudioSource.html */ removeAudioSource( /** Examples of video decoder */ source: VideoDecoder ): Promise /** Stop Player * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.stop.html */ stop(): Promise /** Destroy Player * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.destroy.html */ destroy(): Promise } /** WebAudioContext Example,Through [Vnmf.createWebAudioContext](./createWebAudioContext) Interface fetch the example。 * @supported weapp * @example * Listening state * * ```tsx * const audioCtx = Vnmf.createWebAudioContext() * audioCtx.onstatechange = () => { * console.log(ctx.state) * } * setTimeout(audioCtx.suspend, 1000) * setTimeout(audioCtx.resume, 2000) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.html */ interface WebAudioContext { /** Current WebAudio Context Status。 * * Possible values are as follows::suspended(Pause)、running(Running)、closed(Closed)。 * Here's the thing.,Don't be here. audioContext close We'll see you later. state Properties */ state: string /** Writeable Properties,Developer can set a listening function for this attribute,♪ When WebAudio ♪ When the state changes,A listening function that triggers the developers' set-up。 */ onstatechange: () => void /** Timetamp to get current context。 */ currentTime: number /** Final target node in the current context,It's usually an audio rendering device.。 */ destination: WebAudioContextNode /** Space Audio Listener。 */ listener: AudioListener /** Sample Rate,It's usually in. 8000-96000 Between,Usually 44100hz The most common sampling rate。 */ sampleRate: number /** CloseWebAudioContext * * **Attention.** * Close the corresponding synchronisation WebAudio Context。close We'll release the resources in current context immediately.,**Don't be here. close We'll see you later. state Properties**。 * @supported weapp * @example * ```tsx * const audioCtx = Vnmf.createWebAudioContext() * audioCtx.close().then(() => { * console.log(audioCtx.state) // bad case:It shouldn't be here.closeWe'll see you later.state * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.close.html */ close(): Promise /** Synchronization has been suspended. WebAudioContext Context * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.resume.html */ resume(): Promise /** Synchronization pause WebAudioContext Context * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.suspend.html */ suspend(): Promise /** Create IIRFilterNode * @supported weapp * @example * ```tsx * let lowPassCoefs = [ * { * frequency: 200, * feedforward: [0.00020298, 0.0004059599, 0.00020298], * feedback: [1.0126964558, -1.9991880801, 0.9873035442] * }, * { * frequency: 500, * feedforward: [0.0012681742, 0.0025363483, 0.0012681742], * feedback: [1.0317185917, -1.9949273033, 0.9682814083] * }, * { * frequency: 1000, * feedforward: [0.0050662636, 0.0101325272, 0.0050662636], * feedback: [1.0632762845, -1.9797349456, 0.9367237155] * }, * { * frequency: 5000, * feedforward: [0.1215955842, 0.2431911684, 0.1215955842], * feedback: [1.2912769759, -1.5136176632, 0.7087230241] * } * ] * * const feedForward = lowPassCoefs[filterNumber].feedforward * const feedBack = lowPassCoefs[filterNumber].feedback * const iirFilter = audioContext.createIIRFilter(feedForward, feedBack) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createIIRFilter.html */ createIIRFilter( /** A floating point array,AssignIIRPre-feed of the filter transfer function(Molecular)Factor。 */ feedforward: number[], /** A floating point array,AssignIIRFilter transmits function feedback(denominator)Factor。 */ feedback: number[] ): IIRFilterNode /** Create WaveShaperNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createWaveShaper.html */ createWaveShaper(): WaveShaperNode /** Create ConstantSourceNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createConstantSource.html */ createConstantSource(): ConstantSourceNode /** Create OscillatorNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createOscillator.html */ createOscillator(): OscillatorNode /** Create GainNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createGain.html */ createGain(): GainNode /** Create PeriodicWaveNode * * **Attention.** * `real` and `imag` The array must have the same length.,If you don't, you'll throw a mistake. * * ```tsx * const real = new Float32Array(2) * const imag = new Float32Array(2) * real[0] = 0 * imag[0] = 0 * real[1] = 1 * imag[1] = 0 * * const waveNode = audioContext.createPeriodicWave(real, imag, {disableNormalization: true}) * ``` * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createPeriodicWave.html */ createPeriodicWave( /** A set of cosine chords(It's a tradition.AItem) */ real: Float32Array, /** A set of cosine chords(It's a tradition.AItem) */ imag: Float32Array, /** A Dictionary Object,It specifies whether the norm should be deactivated.(Default Enable Regularization) */ constraints: WebAudioContext.createPeriodicWave.Constraints ): PeriodicWave /** CreateBiquadFilterNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBiquadFilter.html */ createBiquadFilter(): BiquadFilterNode /** Create BufferSourceNode Example,Through AudioBuffer Object to play audio data。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBufferSource.html */ createBufferSource(): AudioBufferSourceNode /** CreateChannelMergerNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createChannelMerger.html */ createChannelMerger( /** Number of input streams in the output stream that need to be maintained */ numberOfInputs: number ): ChannelMergerNode /** CreateChannelSplitterNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createChannelSplitter.html */ createChannelSplitter( /** Number of channels to enter into the audio stream for separate output */ numberOfOutputs: number ): ChannelSplitterNode /** CreateDelayNode * @supported weapp * @example * ```tsx * let audioCtx = Vnmf.createWebAudioContext() * const delayNode = audioCtx.createDelay(5) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createDelay.html */ createDelay( /** Maximum delay */ maxDelayTime: number ): DelayNode /** CreateDynamicsCompressorNode * @supported weapp * @example * ```tsx * let audioCtx = Vnmf.createWebAudioContext() * let compressor = audioCtx.createDynamicsCompressor() * * compressor.threshold.value = -50 * compressor.knee.value = 40 * compressor.ratio.value = 12 * compressor.attack.value = 0 * compressor.release.value = 0.25 * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createDynamicsCompressor.html */ createDynamicsCompressor(): DynamicsCompressorNode /** CreateScriptProcessorNode * @supported weapp * @example * ```tsx * let audioCtx = Vnmf.createWebAudioContext() * const sampleSize = 4096 * audioContext.createScriptProcessor(sampleSize, 1, 1) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createScriptProcessor.html */ createScriptProcessor( /** Buffer Size,In a sample frame. */ bufferSize: number, /** Use to specify input node The number of channels */ numberOfInputChannels: number, /** Use to specify output node The number of channels */ numberOfOutputChannels: number ): ScriptProcessorNode /** CreatePannerNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createPanner.html */ createPanner(): PannerNode /** CreateAudioBuffer,It's a short piece of audio that's in memory. * @supported weapp * @example * ```tsx * const audioCtx = Vnmf.createWebAudioContext() * const channels = 2, frameCount = audioCtx.sampleRate * 2.0 * const myArrayBuffer = audioCtx.createBuffer(channels, frameCount, audioCtx.sampleRate) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBuffer.html */ createBuffer( /** It's defined. buffer Integer number of audio channels included */ numOfChannels: number, /** Representative buffer Integer number of sample frames in */ length: number, /** Sampling rate of linear audio samples,That's the number of frames that each second contains. */ sampleRate: number ): AudioBuffer /** The asymptom decode part of the resource isAudioBuffer。 * @supported weapp * @example * ```tsx * Vnmf.request({ * url: url, // Audio url * responseType: 'arraybuffer', * success: res => { * audioCtx.decodeAudioData(res.data, buffer => { * console.log(buffer) * }, err => { * console.error('decodeAudioData fail', err) * }) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html */ decodeAudioData(): AudioBuffer } namespace WebAudioContext { namespace createPeriodicWave { /** Dictionary Objects */ interface Constraints { /** If specified as true Disable standardization * @default false */ disableNormalization?: boolean } } } /** Acoustic processing module,Different.NodeDifferent functions,LikeGainNode(Volume Adjustment)Wait.。One. WebAudioContextNode It can be created by context.。 * * > So far, the following has been supported:Node: IIRFilterNode WaveShaperNode ConstantSourceNode ChannelMergerNode OscillatorNode GainNode BiquadFilterNode PeriodicWaveNode BufferSourceNode ChannelSplitterNode ChannelMergerNode DelayNode DynamicsCompressorNode ScriptProcessorNode PannerNode * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContextNode.html */ interface WebAudioContextNode { /** Right-hand Cartesian coordinates.XAxis position。 */ positionX: number /** Right-hand Cartesian coordinates.YAxis position。 */ positionY: number /** Right-hand Cartesian coordinates.ZAxis position。 */ positionZ: number /** It means the front of listening system is in same horizontal position Cartesian coordinate system.,As Location(Locationx,Position & Location)Value。 */ forwardX: number /** Shows the audience's forward direction as a position in same Cartesian coordinate system.(Locationx,Position & Location)Vertical position of the value。 */ forwardY: number /** Expressions vs.position (positionX、positionYandpositionZ)It's in the vertical direction of listener at same Cartesian coordinates.(Front and rear)Location。 */ forwardZ: number /** Expressing in relation toposition (positionX、positionYandpositionZ)It's the same Cartesian coordinates as horizontal position of listener's forward direction.。 */ upX: number /** Expressing in relation toposition (positionX、positionYandpositionZ)The same Cartesian coordinates are in the horizontal direction of listener up.。 */ upY: number /** Expressing in relation toposition (positionX、positionYandpositionZ)It's the same Cartesian coordinates as horizontal position of listener back.。 */ upZ: number /** Set the direction of listener * @supported weapp */ setOrientation(...args: any[]): void /** Set the location of listening device * @supported weapp */ setPosition(...args: any[]): void } interface VnmfStatic { /** End of voice play。 * **Attention.:1.6.0 Version Start,This interface is not maintained。Suggested use of more capable [Vnmf.createInnerAudioContext](./createInnerAudioContext) Interface** * @supported weapp * @example * ```tsx * Vnmf.startRecord({ * success: function (res) { * const filePath = res.tempFilePath * Vnmf.playVoice({ filePath }) * * setTimeout(Vnmf.stopVoice, 5000) * } * }) * ``` * @example * ```tsx * Vnmf.startRecord(params).then(res => { * const filePath = res.tempFilePath * Vnmf.playVoice({ filePath }) * * setTimeout(Vnmf.stopVoice, 5000) * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html */ stopVoice(option?: stopVoice.Option): void /** Settings [InnerAudioContext](/docs/apis/media/audio/InnerAudioContext)Item。This set-up is effective for the current micro-program on a global scale.。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html */ setInnerAudioOption(option: setInnerAudioOption.Option): Promise /** Start playing voice。At the same time, only one voice file is allowed to play.,If the previous voice file isn't finished,,Will interrupt previous voice playback。 * @supported weapp * @example * ```tsx * Vnmf.startRecord({ * success: function (res) { * const tempFilePath = res.tempFilePath * Vnmf.playVoice({ * filePath: tempFilePath, * complete: function () { } * }) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html */ playVoice(option: playVoice.Option): Promise /** Pause the voice that's playing。Call again [Vnmf.playVoice](/docs/apis/media/audio/stopVoice)。 * **Attention.:1.6.0 Version Start,This interface is not maintained。Suggested use of more capable [Vnmf.createInnerAudioContext](./createInnerAudioContext) Interface** * @supported weapp * @example * ```tsx * Vnmf.startRecord({ * success: function (res) { * var tempFilePath = res.tempFilePath * Vnmf.playVoice({ * filePath: tempFilePath * }) * setTimeout(function() { * //Pause playback * Vnmf.pauseVoice() * }, 5000) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.pauseVoice.html */ pauseVoice(option?: pauseVoice.Option): void /** Retrieving the currently supported audio input source * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html */ getAvailableAudioSources(option?: getAvailableAudioSources.Option): Promise /** Create WebAudio Context。 * @supported weapp * @example * A simple playdemo * * ```tsx * const audioCtx = Vnmf.createWebAudioContext() * * const loadAudio = (url) => { * return new Promise((resolve) => { * Vnmf.request({ * url, * responseType: 'arraybuffer', * success: res => { * console.log('res.data', res.data) * audioCtx.decodeAudioData(res.data, buffer => { * resolve(buffer) * }, err => { * console.error('decodeAudioData fail', err) * reject() * }) * }, * fail: res => { * console.error('request fail', res) * reject() * } * }) * }) * } * * const play = () => { * loadAudio('xxx-test.mp3').then(buffer => { * const source = audioCtx.createBufferSource() * source.buffer = buffer * source.connect(audioCtx.destination) * source.start() * }).catch(() => { * console.log('fail') * }) * } * * play() * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createWebAudioContext.html */ createWebAudioContext(): WebAudioContext /** Create a media audio player object [MediaAudioPlayer](./MediaAudioPlayer) Object,A video decoder that can be used to play [VideoDecoder](/docs/apis/media/video-decoder/VideoDecoder) Output Audio * * **Attention.** * - iOS 7.0.15 mediaAudioPlayer Play network video resources with audio Caden,There's no problem with the local video.,Fix next client version。 * @supported weapp * @example * ```tsx * // Create a video decoder,For specific parameters, see createVideoDecoder Document * const videoDecoder = Vnmf.createVideoDecoder() * // Create a media audio player * const mediaAudioPlayer = Vnmf.createMediaAudioPlayer() * // Activate video decoder * videoDecoder.start() * // Activate Player * mediaAudioPlayer.start().then(() => { * // Add Player Audio Source * mediaAudioPlayer.addAudioSource(videoDecoder).then(res => { * videoDecoder.getFrameData() // Recommendations in requestAnimationFrame In which to retrieve every frame of video data * console.log(res) * }) * * // Remove Player Audio Source * mediaAudioPlayer.removeAudioSource(videoDecoder).then() * // Stop Player * mediaAudioPlayer.stop().then() * // Destroy Player * mediaAudioPlayer.destroy().then() * // Set the player volume * mediaAudioPlayer.volume = 0.5 * }) *``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html */ createMediaAudioPlayer(): MediaAudioPlayer /** Create Internal audio Context InnerAudioContext Object。 * @supported weapp, h5, rn, tt * @example * ```tsx * const innerAudioContext = Vnmf.createInnerAudioContext() * innerAudioContext.autoplay = true * innerAudioContext.src = 'https://storage.360buyimg.com/jdrd-blog/27.mp3' * innerAudioContext.onPlay(() => { * console.log('Start playing') * }) * innerAudioContext.onError((res) => { * console.log(res.errMsg) * console.log(res.errCode) * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html */ createInnerAudioContext(): InnerAudioContext /** Create audio Context AudioContext Object。 * **Attention.:1.6.0 Version Start,This interface is not maintained。Suggested use of more capable [Vnmf.createInnerAudioContext](./createInnerAudioContext) Interface** * @supported weapp * @example * ```tsx * const audioCtx = Vnmf.createAudioContext('myAudio') * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createAudioContext.html */ createAudioContext( /** [audio](/docs/components/media/audio) Component id */ id: string, /** Under Custom Components,Examples of the current componentthis,To operate inside the component [audio](/docs/components/media/audio) Component */ component?: VnmfGeneral.IAnyObject, ): AudioContext } }