Skip to content

Instantly share code, notes, and snippets.

@adham90
Created June 6, 2023 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adham90/8d7a112dfe336d4395e33b2b7b46f532 to your computer and use it in GitHub Desktop.
Save adham90/8d7a112dfe336d4395e33b2b7b46f532 to your computer and use it in GitHub Desktop.
api_key = "API_KEY" # from https://dash.bunny.net/stream/128158/security
video_id = 'VIDEO_ID'
timestamp = 1.hour.from_now.to_i
token = OpenSSL::Digest::SHA256.hexdigest("#{api_key}#{video_id}#{timestamp}")
# URL
# https://iframe.mediadelivery.net/embed/[Video_Library_ID]/[VIDEO_ID]?token=[TOKEN]&expires=[timestamp]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment