Skip to content

Commit

Permalink
added wait to START_STREAM route
Browse files Browse the repository at this point in the history
Added one second wait before configuring camera, allowing other async routes to finish executing and stop camera instance
  • Loading branch information
LJMU-JackMallo committed Jan 9, 2024
1 parent cd973f6 commit a7d3e4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Import libraries
from utils import *

VERSION = "2.0.2.3"
VERSION = "2.0.2.4"

# Create a new Socket.IO server with specified port
sio = socketio.AsyncServer(cors_allowed_origins='*')
Expand Down Expand Up @@ -77,6 +77,9 @@ async def START_STREAM(sid, data):

print(f"🟠 | Starting video stream to end at {end_time}")

# Wait for 1 second to allow any other routes using camera instance to finish
await asyncio.sleep(1)

# Configure video settings
cam = getCaptureSpec(data,"STREAM")

Expand Down
4 changes: 1 addition & 3 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def getCaptureSpec(data,capture_mode):

# Apply settings
if capture_mode == "STREAM":
camera_config = cam.create_video_configuration(main={"size": (1920, 1080)})
camera_config = cam.create_video_configuration(main={"size": (1920, 1080)}) # Change back to dynamic assignment after tests
cam.options['quality'] = 30

print(f"🟠 | Resolution set to {x}x{y} | Iso set to {iso} | Shutter speed set to {shutterSpeed}")
Expand All @@ -55,5 +55,3 @@ def getCaptureSpec(data,capture_mode):

return cam

#cam.set_controls({"ExposureTime": shutterSpeed})
#cam.set_controls({"ExposureTime": shutterSpeed, "AnalogueGain": round(iso / 100,1)})

0 comments on commit a7d3e4f

Please sign in to comment.