Skip to content
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

Generate multiple tokens with one signPlaybackId call #499

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

decepulis
Copy link
Contributor

@decepulis decepulis commented Oct 12, 2024

Before / After

Before

const playbackToken = await mux.jwt.signPlaybackId(id, {
  expiration: "1d",
  type: "playback"
})
const thumbnailToken = await mux.jwt.signPlaybackId(id, {
  expiration: "1d",
  type: "thumbnail",
  params: { time: 2 }
})
const storyboardToken = await mux.jwt.signPlaybackId(id, {
  expiration: "1d",
  type: "storyboard"
})
const drmToken = await mux.jwt.signPlaybackId(id, {
  expiration: "1d",
  type: "drm_license"
})

<mux-player
  playback-token={playbackToken}
  thumbanil-token={thumbnailToken}
  storyboard-token={storyboardToken}
  drm-token={drmToken}
  playbackId={id}
></mux-player>

After

// { "playback-token", "thumbnail-token", "storyboard-token", "drm-token" }
const tokens = await mux.jwt.signPlaybackId(id, {
  expiration: "1d",
  type: ["playback", ["thumbnail", { time: 2 }], "storyboard", "drm_license"]
})

<mux-player
  {...tokens}
  playbackId={id}
></mux-player>

Notes

See this page for motivation and implementation notes.

Marked as draft

Marked as draft until I'm satisfied with testing and I've gotten some feedback from y'all!

@jsanford8 jsanford8 marked this pull request as ready for review November 14, 2024 23:20
@jsanford8 jsanford8 changed the base branch from master to next November 14, 2024 23:20
@jsanford8 jsanford8 merged commit 4d0e83c into next Nov 14, 2024
3 checks passed
@jsanford8 jsanford8 deleted the dc/generate-multiple-jwts branch November 14, 2024 23:21
jsanford8 added a commit that referenced this pull request Nov 15, 2024
* feat(api): remove sunsetted spaces webhooks

* chore: rebuild project due to codegen change (#432)

* feat(api): OpenAPI spec update via Stainless API (#433)

* feat(api): OpenAPI spec update via Stainless API (#434)

* chore(internal): minor reformatting (#435)

* feat(api): manual updates (#436)

* chore: gitignore test server logs (#437)

* chore: rebuild project due to codegen change (#439)

* chore(api): remove Spaces (#440)

* feat(api): generate webhook types (#441)

* feat(api): make webhooks a standalone api (#442)

* chore: rebuild project due to codegen change (#444)

* chore: rebuild project due to codegen change (#447)

* feat(api): OpenAPI spec update via Stainless API (#448)

* chore: rebuild project due to codegen change (#449)

* chore: rebuild project due to codegen change (#450)

* chore: rebuild project due to codegen change (#452)

* chore: rebuild project due to codegen change (#454)

* chore: rebuild project due to codegen change (#455)

* chore: rebuild project due to codegen change (#456)

* chore(tests): update prism version (#457)

* fix: use relative paths (#458)

* feat(api): OpenAPI spec update via Stainless API (#459)

* fix(compat): remove ReadableStream polyfill redundant since node v16 (#460)

Note that this breaks streaming in Node v14, which has been unsupported since v4.0.0 of this library.

* chore(docs): fix incorrect client var names (#461)

* chore(internal): add constant for default timeout (#463)

* chore(ci): correctly tag pre-release npm packages (#464)

* chore: rebuild project due to codegen change (#465)

* chore: force eslint to use non flat config (#466)

* chore(ci): minor changes (#467)

* chore(ci): bump prism mock server version (#468)

* chore(examples): minor formatting changes (#469)

* chore: rebuild project due to codegen change (#470)

* [video] video_quality as a replacement for encoding_tier (#303)
 (#472)


* Draft changes

* detabbify

* Address Phil's review comments

* chore(ci): check for build errors (#473)

* chore: run tsc as part of lint script (#474)

* chore: replace encoding tiers with video quality levels (#475)

* chore(ci): install deps via ./script/bootstrap (#476)

* fix(client): correct File construction from node-fetch Responses (#478)

* chore(internal): dependency updates (#479)

* chore(internal): minor bump qs version (#480)

* chore: revert jose removal

* fix(uploads): avoid making redundant memory copies (#483)

* fix file permissions

* chore(internal): codegen related update (#484)

* chore(internal): codegen related update (#485)

* fix(errors): pass message through to APIConnectionError (#486)

* chore: better object fallback behaviour for casting errors (#487)

* docs: update CONTRIBUTING.md (#488)

* chore(internal): add dev dependency (#489)

* chore(internal): fix some types (#491)

* fix(types): remove leftover polyfill usage (#492)

* feat(client): send retry count header (#493)

* chore(internal): codegen related update (#494)

* feat(api): api update (#495)

* feat(api): api update (#497)

* feat(api): api update (#500)

* feat(api): api update (#501)

* feat(api): api update (#502)

* chore: rebuild project due to codegen change (#507)

* chore: rebuild project due to codegen change (#508)

* feat(api): api update (#509)

* feat(api): api update (#510)

* chore: rebuild project due to codegen change (#511)

* chore: rebuild project due to codegen change (#513)

* chore: rebuild project due to codegen change (#514)

* chore: rebuild project due to codegen change (#515)

* Generate multiple tokens with one `signPlaybackId` call (#499)

* Generate multiple tokens with one `signPlaybackId` call

* Add missing DataTypeClaim

* wait, I thought of a better signature

* Revert "wait, I thought of a better signature"

This reverts commit 5fdefba.

* fix: ensure config for signPlaybackId can be optional (#516)

* chore: rebuild project due to codegen change (#517)

* chore: rebuild project due to codegen change (#518)

* release: 9.0.0

* update changelog

---------

Co-authored-by: meorphis <[email protected]>
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
Co-authored-by: Stainless Bot <[email protected]>
Co-authored-by: Young-Jin Park <[email protected]>
Co-authored-by: Darius Cepulis <[email protected]>
Co-authored-by: Justin Sanford <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants