 is only supported on https sites.
 ###
 dom.TAWK = ->
+  if not av_initialized
+    initialize_av()
+    av_initialized = true
+
+  # initialize_av asynchronously sets this state once it has figured out whether
+  # the camera and microphone are accessible. For now, only mandate that the
+  # user has a microphone
+  if sb['tawk/av_check'].microphone == undefined
+    return DIV {}, 'Loading microphone...'
+  else if not sb['tawk/av_check'].microphone
+    return DIV {}, 'No microphone was accessible. Please plug one in and grant permission for use.'
+
   # Have to make sure we get all connections to choose
   # whether to join the first group. This state is not
   # used directly, but is necessary to ensure we don't

    me.timeEntered = Date.now()
    me.active = true
    me.space = sb['tawk/space']
    me.video = true
    me.audio = true
    me.avatar_url = next_avatar_url()

  if not agora_initialized

    AV_BUTTON
      danger: !me.video
      onClick: (e) ->
        if window.camera == undefined
          # TODO: warn the user when they don't have an accessible camera but
          # try to turn on video. This silently keeps it off.
          me.video = false
        else
          # TODO: call window.camera.close() to turn off camera entirely. Right
          # now when you turn off video, your camera light is on, even though we
          # aren't using that camera feed.
          me.video = !!!me.video
          window.camera.setEnabled(me.video)
      VIDEO_ICON
        on: !!me.video
        width: 16
