simplecam icon indicating copy to clipboard operation
simplecam copied to clipboard

Audio issues

Open eternalliving opened this issue 3 years ago • 2 comments

I'm running this on a Rpi4 and having some issues with the audio streaming. The recording seems to work fine so I know it's picking up input. It also seems that the script is open multiple sockets for listening, it seems to continuously open new sockets to the client (only running 1 client). I know this is older but was really hoping to be able to implement audio listening on a remote device over flask. Any thoughts would be great. I know things have updated a lot in the last 2 years so maybe I'm running newer incompatible versions? I do have a working Flask and Socketio script working for chat so I know socketio is working.

eternalliving avatar Mar 07 '21 18:03 eternalliving

@eternalliving I've solved this issue, I will fork it and add changes as necessary. You are running into an issue with the socket.io javascript library, you need to make 2 changes to this code to get it working:

  1. in server.py replace socketio = SocketIO(app) with socketio = SocketIO(app,cors_allowed_origins="*") this will resolve a potential CORS issue

  2. in templates/base.html , comment out the existing local reference to socket.io.js <script type="text/javascript" src="{{ url_for('static', filename='lib/socket.io/socket.io.min.js') }}"></script> and replace with the following (updated version): <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.0.4/socket.io.js" integrity="sha512-aMGMvNYu8Ue4G+fHa359jcPb1u+ytAF+P2SCb+PxrjCdO3n3ZTxJ30zuH39rimUggmTwmh2u7wvQsDTHESnmfQ==" crossorigin="anonymous"></script>

If you have no need for video, just audio as you said, you can modify templates/live.html with the following: <!-- <div class="col-12 text-center"> <img class="video" src="{{ url_for('videostream') }}"> </div> --> basically commenting out the div call for videostream. This will prevent the html from calling the source in server.py, which will happily work with no camera/video source atatched.

Cheers

russinnes avatar Apr 19 '21 17:04 russinnes

That's awesome, how in the world did you figure that out!! I'll have to give it a try. Thanks for your effort!

eternalliving avatar Apr 19 '21 18:04 eternalliving