# Using a <video> source instead of the webcam

Demo

Depending on your application you may sometimes want to run the models on a pre-recorded video or livestream. To do that, set the setup.video.$el config to the <video> element containing your video source:

// During instantiation
handsfree = new Handsfree({
  hands: true,
  setup: {
    video: {
      // This element must contain a [src=""] attribute or <source /> with one
      $el: document.querySelector('#my-video')
    }
  }
})

handsfree.start()

You can also switch to a video element if you were previously using the webcam with:

// After instantiation
handsfree.update({
  setup: {
    video: {
      $el: document.querySelector('#my-video')
    }
  }
})
Debugger