<microphone>
A microphone connection to a media server.

JavaScript: lz.microphone
extends <mediadevice> » <node> » lz.Eventable »

The <microphone> element allows you to set up and control a microphone that is connected to a media server. For privacy protection, the allowed attribute must be set to true by the user.

The following figure shows a microphone control.

    <canvas>
        
        <microphone id="m" 
            capturing="${controlpanel.capturing.value}"
        />
        
        <view
            x="10" 
            y="20" 
            width="102" 
            height="12" 
            bgcolor="black"
            >
            <view
                x="1" 
                y="1" 
                bgcolor="yellow" 
                width="${m.level}" 
                height="10"
            />
        </view>
        <view
            y="100"
            >
            <simplelayout
                axis="x" 
                inset="10" 
                spacing="20"
            />
            <view
                layout="axis: y; spacing: 4"
                >
                <text
                    text="${'deviceindex: ' + m.deviceindex}" 
                    resize="true"
                />
                <text
                    text="${'devicename: ' + m.devicename}" 
                    resize="true"
                />
                <text
                    text="${'capturing: ' + m.capturing}"
                    resize="true"
                />
                <text
                    text="${'allowed: ' + m.allowed}"
                    resize="true"
                />
                <text
                    text="${'level: ' + m.level}" 
                    resize="true"
                />
            </view>
            <view
                width="1" 
                height="100" 
                bgcolor="black"
            />
            <view id="controlpanel" 
                layout="axis: y; spacing: 10"
                >
                <checkbox name="capturing"
                    text="Capturing"
                    value="false"
                />
                <button
                    text="Show Settings"
                    onclick="m.showSettings()"
                />
            </view>
        </view>
                        
   </canvas>
                    

Attributes

Name (CSS property) Type (tag) Type (js) Default Category
codec string String NellyMoser initialize-only
  The codec to use, either 'NellyMoser' or 'Speex'.
echosuppression boolean boolean true read/write
  If true, the microphone will attempt to use echo suppression.
encodequality number Number 6 initialize-only
  The quality of encoded speech quality when using the Speex codec. Possible values are from 0 to 10.
framesperpacket number Number 6 initialize-only
  Number of Speex speech frames transmitted in a packet.
gain number Number 50 read/write
  The amount the microphone boosts the signal.
level number Number 0 readonly
  Audio level, 0-100, the amount of sound detected by this microphone. Reset to 0 when there is no audio (no activity or not allowed).
rate number Number 8 initialize-only
  Rate in khz the microphone is using to capture sound, either 5, 8, 11, 22, or 44.
silencelevel number Number 10 read/write
  Silence level, 0-100, the amount of sound required to activate the microphone.
silencetimeout number Number -1 read/write
  Silence timeout in ms, the amount of silent time signifying that silence has actually begun.
stream expression any null read/write
  Mediastream to associate with the microphone, for audio recording.

Methods

startDevice()
microphone.startDevice();
Start the microphone.

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy