Direct link to Youtube Video

It would be great to have an external link to open and play a video directly from a youtube gallery. Maybe a simple share button on the video within the gallery that would produce a full url that opens that specific video.

Ive created a basic script that uses a query string of the youtube video to fire the video, not elegant but it works....

setTimeout(function() {

var url = window.location.search;

(function($) {

$.QueryString = (function(a) {

if (a == "") return {};

var b = {};

for (var i = 0; i < a.length; ++i)

{

var p=a[i].split('=');

if (p.length != 2) continue;

b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));

}

return b;

})(window.location.search.substr(1).split('&'))

})(jQuery);


// Usage

var param = jQuery.QueryString["v"];

if (url.match("v").length > 0) {

jQuery("[data-yt-id='" + param + "'] ").click();

}

}, 5000);

  • Brave World
  • Apr 14 2022
  • Future consideration
  • Admin
    Helga R commented
    April 18, 2022 09:56

    Hello there,

    Thanks a lot for adding your idea along with the solution! I do believe it might appear useful for many users.

    We'll try our best to consider your request in our future updates and include an external link option.

    Also, I believe your CSS code would be of great use on our Community Forum, and we'd be extremely grateful if you could share it there: https://community.elfsight.com/.

    Thanks a lot for helping us!


    Helga, Community Manager

    Join our online meeting space - Community Forum
    Keep up with latest updates - Facebook
    Get to know our team - Instagram