Embedding a YouTube video in a PeopleSoft pagelet

This article describes how to create a pagelet for the PeopleSoft portal home page that contains an embedded YouTube video. It will even allow you to switch the video based on the language the user is logged in.

Create a pagelet

Create a new pagelet via PeopleTools > Portal > Pagelet Wizard > Pagelet Wizard.

Create a new pagelet and in step 2 choose Free Text as data type. Use the code displayed below as free text and adapt where needed. In step 4 choose Passthru. Finish the rest of the wizard as usual.

<div id="p1">.</div>

<script>
    var languageCd = document.getElementsByTagName("html")[0].getAttribute("lang");
    var urlDut = "https://www.youtube.com/embed/<unique identifier>";
    var urlEng = "https://www.youtube.com/embed/<unique identifier>";
    var urlFra = "https://www.youtube.com/embed/<unique identifier>";
    var url = "";
    var frameHtml = "";

    switch (languageCd) {
        case 'en':
            url = urlEng;
            break;
        case 'nl':
            url = urlDut;
            break;
        case 'fr':
            url = urlFra;
            break;
        default:
            url = urlEng;
    }    

    frameHtml = "<iframe width='560' height='315' src='";
    frameHtml = frameHtml + url + "?wmode=opaque&rel=0&modestbranding=1&showinfo=0";
    frameHtml = frameHtml + "' frameborder='0' allowfullscreen='1' ></iframe>";
    document.getElementById("p1").innerHTML = frameHtml;
</script>

You will now be able to add the pagelet to the homepage of the user. The end result will look something like this.

Capture

3 thoughts on “Embedding a YouTube video in a PeopleSoft pagelet”

  1. Heya i am for the primary time here. I came across this board and I to find It really helpful & it helped me out much. I am hoping to offer one thing again and aid others such as you helped me.

    Reply
  2. After examine just a few of the weblog posts on your website now, and I actually like your way of blogging. I bookmarked it to my bookmark website listing and will be checking back soon. Pls take a look at my site as properly and let me know what you think.

    Reply

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.