So I'm trying to run a python flask app which should render a html template which will record audio and send it to my flask server. I'm new to p5.js and I'm not able to run/get audio input on my web page. I've tried several solution mentioned in SO and youtube tuts but couldn't get it to work.
This is my file structure and scripts:
---> files
---> sketch.js
---> templates
---> index.html
---> app.py
index.html :-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Jarvis</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js"></script>
</head>
<body>
Hello, This is home page!
<script type="text/javascript" src="../files/sketch.js"></script>
</body>
</html>
sketch.js :-
var mic;
function setup(){
mic = new p5.AudioIn();
mic.start();
}
function draw() {
}
app.py :-
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template('index.html')
if __name__ == "__main__":
app.run(debug=True)
It's a simple example and I can't get it work.
When I run python app.py
everything works with no errors but the browser does not ask for mic permission, nothing happens.
I'm on Windows 10 and using Firefox browser. (Tried on Google Chrome too, same problem!)
If anyone could help me or guide me, it would be really appreciated!