How to embed different YouTube videos to separate discussion forums?
Hi there,
I want to embed various YouTube videos to separate discussion forums. Clicking of the image should open up a modal dialog which should play the video. Can this be achieved using the standard "video" component or should I create a customised component? Please see the attached image files that I am trying to achieve.
I have to update with the same video for various forum URLs which has same pageName, in some cases it has different pagenames. Any guidance in this would be much appreciated. Thanks.
Regards,
Laks
Hi Laks,
Assuming you're placing the custom component on the Forum Page, you shouldn't need to do anything with the URL. Instead, you can take advantage of how custom content modules work. In the first option I laid out, a custom content module was to be used for storing the vidoe URL (or video ID if that's how you'd prefer to do it).
So let's say for example that you're going to use Custom Content 9 for storing your video ID. Each node of the community (the community level, each category, each board) has its own version of Custom Content 9 associated with it. If you add content for Custom Content 9 at the community level, then it sets the default for the lower levels. Similarly, if you add custom content at the category level, it sets the default for those nodes within that category. But you can still override that for individual boards and at whatever content you'd like for each board.
So let's start with Board ABC:
- Browse to the Community Admin
- Select to manage Board ABC
- Select the Content tab, and then Custom Content
- From the drop down, select Custom Content 9
- Within the Custom Content 9 Text, enter the video ID for the video, (ie. "dQw4w9WgXcQ")
Then you can repeat for Board DEF, Board GHI, and so on...
Then, back in your custom component where you've added the code for your video modal/player, you'll need to get the video ID associated with the Forum Page that the component is rendering on. In my last post, I mentioned that the values of the Custom Content modules are stored as settings for each node. And in this case, you'll want to get the setting named customcontent.9_text. So you should be able to do something like this to get the video id:
${coreNode.settings.name.get("customcontent.9_text")}
So if your component is rendering on Board ABC, it's going to grab the value set in the admin for Custom Content 9 for Board ABC. If your component is rendering on Board DEF, it's going to grab the value set in the admin for Custom Content 9 for Board DEF. And so on...
Does that make sense? Let me know if you need more details.