4

I am trying to automate a website that has a webcam stream in it. In order to automate it, I need some way to fake a webcam.

I know the option -use-fake-device-for-media-stream simulates a webcam in Chrome. This is working for me in Chrome. Now I need to get the same working in Firefox.

I got the following information from internet while researching on this. "In Firefox, a special fake:true variable in the getUserMedia() calls will achieve this".

I did not understand how to code this up. Can anyone advice please? I am using java based selenium.

Eugene S
  • 6,709
  • 8
  • 57
  • 91
Juby
  • 51
  • 1
  • 5

2 Answers2

4

This can be done in Firefox at various levels:

  • System
  • User Level
  • Profile Level etc

Set following props in either user.js, pref.js or channel-prefs.js

pref("media.navigator.permission.disabled", true);
pref("media.navigator.streams.fake", true);

OR

user_pref("media.navigator.permission.disabled", true);
user_pref("media.navigator.streams.fake", true);

Then reboot your machine or restart firefox service.

After that call your URL which invokes getUserMedia() Firefox will display Fake Audio/Video.

Zoltan Toth
  • 46,981
  • 12
  • 120
  • 134
3

You can use:

profile.setPreference('media.navigator.streams.fake', true);
Ostap Maliuvanchuk
  • 1,125
  • 2
  • 12
  • 32