IBehaviour implementation that listens for a onmouseup/down on the given recordButton.

onmouseup starts the recording, onmousedown stops the recording and publishes an audio message to the outbound audio channel.

### Hierarchy

- IBehaviour
  - VoiceBehaviour

## Index

### Constructors

- constructor

### Properties

- bindings
- callback
- channelId
- recorder
- subscription
- target

### Methods

- bind
- handleAudio
- init
- isValueValid
- startRecordingOnMouseDown
- stopRecordingOnMouseUp
- unbind

## Constructors

### constructor

- new VoiceBehaviour(recordButton: HTMLButtonElement, recorder?: AudioRecorder, callback?: function): VoiceBehaviour

- Overrides IBehaviour.constructor

  - Defined in lib/behaviour/VoiceBehaviour.ts:19

  #### Parameters

  - ##### recordButton: HTMLButtonElement

  - ##### Default value recorder: AudioRecorder = WebRTCRecorder.instance()

  - ##### Default value callback: function = () => undefined

    - - (eventType: AudioEventType): void

      - #### Parameters

        - ##### eventType: AudioEventType

        #### Returns void

  #### Returns VoiceBehaviour

## Properties

### Protected bindings

bindings: BehaviorBinding[]

Inherited from IBehaviour.bindings

- Defined in lib/api/IBehaviour.ts:11

### Private callback

callback: function

- Defined in lib/behaviour/VoiceBehaviour.ts:19

#### Type declaration

- - (eventType: AudioEventType): void

  - #### Parameters

    - ##### eventType: AudioEventType

    #### Returns void

### channelId

channelId: string | null = null

Inherited from IBehaviour.channelId

- Defined in lib/api/IBehaviour.ts:12

### Private recorder

recorder: AudioRecorder

- Defined in lib/behaviour/VoiceBehaviour.ts:18

### Protected subscription

subscription: Subscription | null

Inherited from IBehaviour.subscription

- Defined in lib/api/IBehaviour.ts:10

### Protected target

target: HTMLElement

Inherited from IBehaviour.target

- Defined in lib/api/IBehaviour.ts:9

## Methods

### bind

- bind(gateway: Subscription): void

- Overrides IBehaviour.bind

  - Defined in lib/behaviour/VoiceBehaviour.ts:36
  inheritdoc

  #### Parameters

  - ##### gateway: Subscription

  #### Returns void

### handleAudio

- handleAudio(msg: object): void

- - Defined in lib/behaviour/VoiceBehaviour.ts:60

  #### Parameters

  - ##### msg: object

  #### Returns void

### init

- init(channelId: string): void

- Inherited from IBehaviour.init

  - Defined in lib/api/IBehaviour.ts:20

  #### Parameters

  - ##### channelId: string

  #### Returns void

### isValueValid

- isValueValid(value: string): null | false | true | ""

- Inherited from IBehaviour.isValueValid

  - Defined in lib/api/IBehaviour.ts:38

  #### Parameters

  - ##### value: string

  #### Returns null | false | true | ""

### Private startRecordingOnMouseDown

- startRecordingOnMouseDown(): void

- - Defined in lib/behaviour/VoiceBehaviour.ts:44

  Binds {@link AudioRecorder#startRecording} to {@link this#recordButton} when an "mousedown" event occurs

  #### Returns void

### Private stopRecordingOnMouseUp

- stopRecordingOnMouseUp(gateway: Subscription): void

- - Defined in lib/behaviour/VoiceBehaviour.ts:52

  Binds {@link AudioRecorder#stopRecording} to {@link this#recordButton} when an "mouseup" event occurs

  #### Parameters

  - ##### gateway: Subscription

  #### Returns void

### unbind

- unbind(): void

- Inherited from IBehaviour.unbind

  - Defined in lib/api/IBehaviour.ts:44

  Removes the active event listeners

  #### Returns void

Generated using TypeDoc