I’m embarrassed to ask this question, but where can I get the YouTube component? Is there a library somewhere?
I found the tutorial with the component already included but I need to import it into my existing project.
I’m embarrassed to ask this question, but where can I get the YouTube component? Is there a library somewhere?
I found the tutorial with the component already included but I need to import it into my existing project.
It’s not built into the studio at the moment
You can set it up as a custom code component; do you already have custom app hosting set up? https://docs.plasmic.app/learn/code-components/
Thanks for the assist in the right direction. I’ve created my plasmic-init.ts
and included my ID and API token. I’ve also added react-youtube with yarn add react-youtube
. Then I added import YouTube from "react-youtube";
to the header of plasmic-init.ts
.
But beyond that, it’s not clear to me how to make the component visible to the builder.
Ah great! Actually we have a helper to help you register the react-youtube
component. You can do this:
yarn add @plasmicpkgs/react-youtube
Then, in your plasmic-init.ts
,
import {registerYouTube} from "@plasmicpkgs/react-youtube";
export const PLASMIC = initPlasmicLoader(...);
registerYouTube(PLASMIC);
OK, much better progress. At this point, I’ve:
yarn add @plasmicpkgs/react-youtube
import {registerYouTube} from "@plasmicpkgs/react-youtube";
registerYouTube(PLASMIC);
I promise to writeup a gist for this if I get it working. I understand that your time is valuable.
(oof we really gotta improve these docs )
ok, it look like I’m close now, but there does seem to be an issue with the fact that localhost is served over non-ssl while the plasmic UI is ssl.
Even closer now. Looks like it was important to remove the http:// prepended on the input field.
Still no component called react-youtube in my component list or the Interactive Components
Oh, wow! It showed up in code components…yeah!!!
Next question. There appear to be props that I cannot disable: “Related Videos” for example. Is there anything I can do to override this behavior?
Bill, in the index.tsx of the react-youtube package you would want to comment/remove the following code that creates the Related Videos prop: (Starts at line 173)
rel: {
type: "boolean",
displayName: "Related Videos",
description:
"Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)",
defaultValueHint: true,
},