21 lines
565 B
Python
21 lines
565 B
Python
"""Generate LiveKit access tokens for the camera participants."""
|
|
|
|
from livekit.api import AccessToken, VideoGrants
|
|
|
|
|
|
def make_token(url: str, api_key: str, api_secret: str,
|
|
room: str, identity: str) -> str:
|
|
token = (
|
|
AccessToken(api_key, api_secret)
|
|
.with_identity(identity)
|
|
.with_name(identity)
|
|
.with_grants(VideoGrants(
|
|
room_join=True,
|
|
room=room,
|
|
can_publish=True,
|
|
can_subscribe=True,
|
|
can_publish_data=True,
|
|
))
|
|
)
|
|
return token.to_jwt()
|