I am developing an application where I need microphone access. So, anyone can tell me the python code for asking microphone permission in Chrome or any other Browser.
1 Answer
Try the below code
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
options.add_argument('use-fake-device-for-media-stream')
driver = webdriver.Chrome(chrome_options=options)
Or else you can pass the chrome profile that has microphone enabled for your application
options.add_argument("user-data-dir=<profilepath>")
eg
options.add_argument("user-data-dir=c:\profile\user-data")
if the profile is not in user-data\default then you have to also add
options.add_argument('--profile-directory=<folder_name>')
-
I have a link and when I clicked on the link it will call a python function. And also on clicking the link, I want to get microphone access. So that I can get the speech audio and then I will convert to text (using speech recognizer) and do the further process. So, where I will place the code to do all this work? Commented Jan 31, 2020 at 18:59
-
@SubhadipMondal Before you create chrome driver ! driver = webdriver.Chrome(chrome_options=options)– PDHideCommented Jan 31, 2020 at 19:03