Skip to content

Commit

Permalink
fix: On update, allow streaming if stream is not valid but event has …
Browse files Browse the repository at this point in the history
…a Test RMTP URL setup
  • Loading branch information
munshkr committed Feb 12, 2024
1 parent bb0bb74 commit 79cf36a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions events/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,17 @@ def on_update(request):
)
return HttpResponseForbidden("Stream was preparing and is now active. Retry")

if not stream.is_valid_at(now):
print("[UPDATE] Stream is not valid at %s" % (now))
return HttpResponseForbidden("Stream is not valid now")
# If stream was active and is now inactive, force disconnection
if stream.is_active_at(last_update) and not stream.is_active_at(now):
print("[UPDATE] Stream was active and is now inactive. Force disconnection.")
return HttpResponseForbidden("Stream was active and is now inactive. Retry")

# If stream is not valid and there is no test RTMP URL for this event, force disconnection
if not stream.is_valid_at(now) and not stream.event.test_rtmp_url:
print("[UPDATE] Stream is not valid. Disconnect.")
return HttpResponseForbidden("Stream is not valid")

# Otherwise, allow
return HttpResponse("OK")


Expand Down

0 comments on commit 79cf36a

Please sign in to comment.