Skip to content

Commit

Permalink
Simplify Cloudflare config with new endpoint (#135)
Browse files Browse the repository at this point in the history
Old instructions will still work, but we now have an endpoint that matches the `RTCPeerConnection` signature exactly.
  • Loading branch information
mhart authored Mar 7, 2025
1 parent f59e8c3 commit 7dfee78
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,20 @@ turn_key_api_token = os.environ.get("TURN_KEY_API_TOKEN")
ttl = 86400 # Can modify TTL, here it's set to 24 hours

response = requests.post(
f"https://rtc.live.cloudflare.com/v1/turn/keys/{turn_key_id}/credentials/generate",
f"https://rtc.live.cloudflare.com/v1/turn/keys/{turn_key_id}/credentials/generate-ice-servers",
headers={
"Authorization": f"Bearer {turn_key_api_token}",
"Content-Type": "application/json",
},
json={"ttl": ttl},
)
if response.ok:
ice_servers = [response.json()["iceServers"]]
rtc_configuration = response.json()
else:
raise Exception(
f"Failed to get TURN credentials: {response.status_code} {response.text}"
)

rtc_configuration = {"iceServers": ice_servers}

stream = Stream(
handler=...,
rtc_configuration=rtc_configuration,
Expand Down

0 comments on commit 7dfee78

Please sign in to comment.