Menu

Expand
Rate this page:

PlaybackGrant

The PlaybackGrant resource allows developers to generate a grant to initialize the Player SDK. The grant provides a playback token that the Player will use to connect to the livestream.

API Base URL

All URLs in the reference documentation use the following base URL:

https://media.twilio.com/v1

PlaybackGrant properties

Resource Properties in REST API format
sid
sid<VJ> Not PII

The unique string generated to identify the PlayerStreamer resource that this PlaybackGrant authorizes views for.

url
url Not PII

The absolute URL of the resource.

account_sid
sid<AC> Not PII

The SID of the Account that created this resource.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in ISO 8601 format.

grant
object Not PII

The grant that authorizes the player sdk to connect to the livestream

Create a PlaybackGrant

URL

# HTTP POST
https://media.twilio.com/v1/PlayerStreamers/{PlayerStreamerSID}/PlaybackGrant

Parameters

Parameters in REST API format
sid
Path
post sid<VJ> Not PII

The unique string generated to identify the PlayerStreamer resource associated with this PlaybackGrant

ttl
Optional
post integer Not PII

The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds.

access_control_allow_origin
Optional
post string Not PII

The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain.

Example: Create a PlaybackGrant

        
        
        

        Example: Create a PlaybackGrant with a 60-second TTL

              
              
              

              Example: Attach a PlaybackGrant to an Access Token

              In order to attach a PlaybackGrant to an Access Token, you will first need to create a PlaybackGrant via the REST API. Once you have created the PlaybackGrant, you must wrap it in a PlaybackGrant object from Twilio's jwt helper library to attach it to an Access Token. This code sample shows how to both create a PlaybackGrant via the API and then attach it to an Access Token.

                    
                    
                    
                    Rate this page:

                    Need some help?

                    We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                          
                          
                          

                          Thank you for your feedback!

                          Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                          Sending your feedback...
                          🎉 Thank you for your feedback!
                          Something went wrong. Please try again.

                          Thanks for your feedback!

                          Refer us and get $10 in 3 simple steps!

                          Step 1

                          Get link

                          Get a free personal referral link here

                          Step 2

                          Give $10

                          Your user signs up and upgrade using link

                          Step 3

                          Get $10

                          1,250 free SMSes
                          OR 1,000 free voice mins
                          OR 12,000 chats
                          OR more