ViewedIt is now Vidyard GoVideo! Click here to learn more.

How do I automatically launch a Vidyard player when I load a page?

Overview

You may have a requirement to automatically launch a lightbox player when a page is loaded. 

Solution

Although there is not a simple query string you can add to your Vidyard embed code, you can accomplish this by adding an extra set of scripts to your page.

After copying these scripts, simply place your lightbox embed code in between the section that looks like this:

<!-- Start lightbox embed code -->

<!-- End lightbox embed code -->


You will also need to replace the UUID that appears here to match your player. In this example the UUID is 'abc123DEF456efg789':

fn_vidyard_abc123DEF456efg789();


You can adjust the 'playvideo' text to be something of your choosing:

var urlParam = get_parameter_by_name("playvideo");


By using this code:

  • Heading to the page without a query string will still show the normal website.
  • Adding the query string ?playvideo=1 to the URL- will load the page and launch the Vidyard player in lightbox

<script type="text/javascript">
// Parsing the query string 
function get_parameter_by_name(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
    if (results == null) {
    return "";
        } else {
        return results[1];
        }
    }
</script>

<script type="text/javascript">
// Determine the value of the playvideo parameter and launch the player if 1
    var urlParam = get_parameter_by_name("playvideo");
    function videoCheck() {
        if (urlParam[0]=="1") {
// Get this next value from the lightbox embed code below, within onclick. It should look something like this but with a different UUID:
        fn_vidyard_abc123DEF456efg789();
        }
    }
</script>

<!-- Start lightbox embed code -->

<!-- End lightbox embed code -->

<script type="text/javascript">
// On page load, check the playvideo parameter value
    window.onload = function () {
        videoCheck();
    }
</script>

Was this article helpful?

Can’t find what you’re looking for? Please contact us below.

Email Vidyard Support
Why you didn't like the article?

If you would like Vidyard to get in contact with you regarding your feedback, please enter your email address.

  • No, Thanks