human: 如何处理七牛云的实时音视频QNLocalAudioTrack

gpt: [实时音视频](https://developer.qiniu.com/rtc) > API 文档 > Uniapp >QNLocalAudioTrack

#  QNLocalAudioTrack

最近更新时间: 2023-12-11 15:59:55

Hierarchy

  * [QNLocalTrack](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/11386/UniappQNLocalTrack)
    * QNLocalAudioTrack 

Index

Property

  * getMuted
  * kind
  * tag
  * trackID
  * userID

Method

  * addAudioFilter
  * destroy
  * getTag
  * getTrackID
  * getUserID
  * getVolumeLevel
  * isAudio
  * isMuted
  * isVideo
  * off
  * on
  * removeAudioFilter
  * setMuted
  * setVolume

Property

getMuted

  * getMuted: {}
  * 是否 muted

kind

  * kind: [QNRTCTrackKind](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/11395/UniappQNRTCTrackKind)
  * 类型

tag

  * tag: string
  * 自定义 tag

trackID

  * trackID: string
  * trackID

userID

  * userID: string
  * 用户 ID

Method

addAudioFilter

  * addAudioFilter(filter: ([QNAudioMusicMixer](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/12610/UniappQNAudioMusicMixer) | [QNAudioEffectMixer](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/12611/UniappQNAudioEffectMixer))): void
  * 增加 filter 模块

> 目前支持设置 QNAudioMusicMixer、QNAudioEffectMixer 等内置 Filter

Parameters

    * filter: ([QNAudioMusicMixer](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/12610/UniappQNAudioMusicMixer) | [QNAudioEffectMixer](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/12611/UniappQNAudioEffectMixer)) 

模块

Returns void

destroy

  * destroy(): void
  * 销毁本地创建的 Track

Returns void

getTag

  * getTag(): string
  * 获取 Tag

Returns string

getTrackID

  * getTrackID(): string
  * 获取 TrackID

> 对于本地 Track，当且仅当 Track 发布后才可获取到有效的 TrackID；对于远端 Track，可随时获取到有效的 TrackID

Returns string

getUserID

  * getUserID(): string
  * 获取 UserID

Returns string

getVolumeLevel

  * getVolumeLevel(): number
  * 获取当前音频输入设备采集的音量大小

> 可通过定时调用该方法获取音量值的方式来判断当前用户是否在讲话 在安静的环境下，获取到 0.0x 大小的数值为预期现象，您可根据您的需求自行决定判断的阈值

Returns number

isAudio

  * isAudio(): boolean
  * 是否为音频 Track

Returns boolean

isMuted

  * isMuted(): boolean
  * 是否 muted

Returns boolean

isVideo

  * isVideo(): boolean
  * 是否为视频 Track

Returns boolean

off

  * off(name: event, listener: [QNRTCTrackEvent](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/11409/UniappQNRTCTrackEvent)[event]): void
  * 取消监听对应的事件

> 取消监听对应的事件

Parameters

    * name: event 

事件名

    * listener: [QNRTCTrackEvent](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/11409/UniappQNRTCTrackEvent)[event] 

事件句柄

Returns void

on

  * on(name: event, listener: [QNRTCTrackEvent](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/11409/UniappQNRTCTrackEvent)[event]): void
  * 监听对应的事件

> 支持多次调用同一事件

Parameters

    * name: event 

事件名

    * listener: [QNRTCTrackEvent](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/11409/UniappQNRTCTrackEvent)[event] 

事件句柄

Returns void

removeAudioFilter

  * removeAudioFilter(filter: ([QNAudioMusicMixer](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/12610/UniappQNAudioMusicMixer) | [QNAudioEffectMixer](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/12611/UniappQNAudioEffectMixer))): void
  * 移除 filter 模块

Parameters

    * filter: ([QNAudioMusicMixer](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/12610/UniappQNAudioMusicMixer) | [QNAudioEffectMixer](https://developer.qiniu.com/rtc/11417/UniappQNLocalAudioTrack/12611/UniappQNAudioEffectMixer)) 

模块

Returns void

setMuted

  * setMuted(muted: boolean): void
  * 设置 mute

> 更新当前 Track 的 mute 值

Parameters

    * muted: boolean 

是否 mute

Returns void

setVolume

  * setVolume(volume: number): void
  * 设置音量

> 设置设备上当前音频输入设备采集后音量，默认 1 范围 [0,10]

Parameters

    * volume: number 

音量值

Returns void

以上内容是否对您有帮助？