Skip to content

Commit

Permalink
Add primaryColor prop 🎨
Browse files Browse the repository at this point in the history
Removing tsdx lint since it's currently broken, and adding a clean
script to clear files that prettier shouldn't be concerned with.
  • Loading branch information
third774 committed Oct 28, 2021
1 parent 9298956 commit dbaa673
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test --passWithNoTests",
"lint": "tsdx lint",
"clean": "rm -rf ./dist && rm -rf ./example/.cache && rm -rf ./example/dist",
"prepare": "tsdx build",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
Expand All @@ -33,7 +33,7 @@
},
"husky": {
"hooks": {
"pre-commit": "yarn prettier && tsdx lint"
"pre-commit": "yarn clean && yarn prettier"
}
},
"author": "Kevin Kipp",
Expand Down
3 changes: 3 additions & 0 deletions src/Stream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const StreamEmbed: FC<StreamProps> = ({
autoplay = false,
loop = false,
preload = "metadata",
primaryColor,
defaultTextTrack,
height,
width,
Expand Down Expand Up @@ -149,6 +150,7 @@ export const StreamEmbed: FC<StreamProps> = ({
autoplay,
controls,
poster,
primaryColor,
adUrl,
defaultTextTrack,
});
Expand All @@ -160,6 +162,7 @@ export const StreamEmbed: FC<StreamProps> = ({
useProperty("currentTime", ref, currentTime);
useProperty("loop", ref, loop);
useProperty("preload", ref, preload);
useProperty("primaryColor", ref, primaryColor);
useProperty("volume", ref, volume);

// instantiate API after properties are bound because we want undefined
Expand Down
8 changes: 8 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export interface StreamPlayerApi {
* The <video> element does not force the browser to follow the value of this attribute; it is a mere hint. Even though the preload="none" option is a valid HTML5 attribute, Stream player will always load some metadata to initialize the player. The amount of data loaded in this case is negligable.
*/
preload: Preload;
/**
* Any valid CSS color provided will be applied to certain elements of the player's UI.
*/
primaryColor?: string;
/**
* Unsubscribe from events
*/
Expand Down Expand Up @@ -140,6 +144,10 @@ export interface StreamProps {
* The <video> element does not force the browser to follow the value of this attribute; it is a mere hint. Even though the preload="none" option is a valid HTML5 attribute, Stream player will always load some metadata to initialize the player. The amount of data loaded in this case is negligable.
*/
preload?: Preload;
/**
* Any valid CSS color provided will be applied to certain elements of the player's UI.
*/
primaryColor?: string;
/**
* Automatically manages the aspect ratio of the iframe for you. Defaults to true. If you want to manually handle the styles yourself, set this to false.
*/
Expand Down
3 changes: 3 additions & 0 deletions src/useIframeSrc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface IframeSrcOptions {
autoplay?: boolean;
controls?: boolean;
poster?: string;
primaryColor?: string;
adUrl?: string;
defaultTextTrack?: string;
preload?: Preload;
Expand All @@ -21,6 +22,7 @@ export function useIframeSrc(
autoplay,
controls,
poster,
primaryColor,
adUrl,
defaultTextTrack,
}: IframeSrcOptions
Expand All @@ -30,6 +32,7 @@ export function useIframeSrc(
adUrl && `ad-url=${encodeURIComponent(adUrl)}`,
defaultTextTrack &&
`defaultTextTrack=${encodeURIComponent(defaultTextTrack)}`,
primaryColor && `primaryColor=${encodeURIComponent(primaryColor)}`,
muted && "muted=true",
preload && `preload=${preload}`,
loop && "loop=true",
Expand Down

0 comments on commit dbaa673

Please sign in to comment.