-
Notifications
You must be signed in to change notification settings - Fork 51
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/arbitrary src params #834
Feat/arbitrary src params #834
Conversation
@cjpillsbury is attempting to deploy a commit to the Mux Team on Vercel. A member of the Team first needs to authorize it. |
packages/mux-player/src/index.ts
Outdated
// @ts-ignore | ||
if (!this.hasAttribute(PlayerAttributes.EXTRA_PLAYLIST_PARAMS)) return DEFAULT_EXTRA_PLAYLIST_PARAMS; | ||
return [ | ||
...new URLSearchParams(this.getAttribute(PlayerAttributes.EXTRA_PLAYLIST_PARAMS) as string).entries(), |
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.
NOTE: Uses URLSearchParams
constructor to more easily/reliably parse the attribute string, which acts as the "source of truth" for the value.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #834 +/- ##
==========================================
+ Coverage 82.50% 82.54% +0.04%
==========================================
Files 40 40
Lines 8305 8332 +27
Branches 457 461 +4
==========================================
+ Hits 6852 6878 +26
- Misses 1447 1448 +1
Partials 6 6
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/mux-player/src/index.ts
Outdated
...state, | ||
// NOTE: since the attribute value is used as the "source of truth" for the property getter, | ||
// moving this below the `...state` spread so it resolves to the default value when unset (CJP) | ||
extraPlaylistParams: el.extraPlaylistParams, |
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.
We should consider this convention for all of the acrobatics we've had with our generic state update from attr values in attributeChangedCallback()
. tl;dr - if our mux-player prop value is always derived from the corresponding mux-player attr value, we should move those below our state
spread. (cc @luwes)
…d tests. Added commented out example usage in next MuxPlayer page.
1bc3d12
to
a5a2de3
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.
👍
Mux Player
extraSourceParams
(prop) /extra-source-params
(attr) allows users to specify any arbitrary search/query params for the resultantsrc
URL (based on, e.g.playbackId
and other specific props/attrs used to construct the URL).