-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add PlaybackGrant. #700
feat: Add PlaybackGrant. #700
Conversation
88fe86d
to
3fea908
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 🇮🇹
@@ -177,6 +177,22 @@ declare namespace AccessToken { | |||
endpointId?: string; | |||
} | |||
|
|||
export interface PlaybackGrantOptions { | |||
grant?: object; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on this sample from the test, I think we should look into typing grant
more specifically since object
is a very loose definition.
var playbackGrant = {
requestCredentials: null,
playbackUrl: 'https://000.us-east-1.playback.live-video.net/api/video/v1/us-east-000.channel.000?token=xxxxx',
playerStreamerSid: 'VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
};
var grant = new twilio.jwt.AccessToken.PlaybackGrant();
grant.grant = playbackGrant;
Maybe a new interface to DRY things up?:
export interface PlaybackGrantResponse {
requestCredentials: string | null;
playbackUrl: string;
playerStreamerSid: string;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. Also need to do the same in other languages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for the suggestion -- we chatted and are planning to do this step in a separate PR, to speed up getting these into the helper libraries. But definitely going to make a new PR to clean this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The playback grant is supposed to be an opaque object returned by a Live API, none of these fields have to be provided by the developer. While adding typing seems like a good idea in principle, this is going to break if/when the Twilio Live team decide to make changes to the format of the grant, like maybe add a new field. I'm not really sure what the best option is, just wanted to point out that there are downsides to adding typing about private attributes of the grant.
I was able to verify here that I could add a PlaybackGrant to a token and connect with it:
|
Fixes
Adds PlaybackGrants.
Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.