The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums

    Twitch clips embed

    avatar
    Simone Boi
    Forumember


    Posts : 90
    Reputation : 2
    Language : Italian

    Twitch clips embed Empty Twitch clips embed

    Post by Simone Boi December 18th 2020, 16:26

    Hi guys! I'm sorry to bother you, I've added twitch channels and twitch videos embed in my forum's post, but i can't make clip works.

    I'm using this:

    Code:
    $(function(){
      $('.postbody a[href*="twitch.tv"]').each(function() {
        var clip = '/clip/';
        var ytid = $(this).attr('href').replace(new RegExp('.*' + clip), '');
        $(this).html('<iframe src="https://clips.twitch.tv/embed?clip=' +ytid+ '&parent=www.galaxypledges.net"' + " frameborder='0' allowfullscreen='true' scrolling='no' height='378' width='620'></iframe><br />");
    });
    });

    can't understand why he doesn't work, any help please?


    ---------------- edit: it works, but it conflits with "channel and video embed"

    Code:
      $('.postbody a[href*="twitch.tv"]').each(function() {
        var ytid = $(this).attr('href').split("twitch.tv/")[1].split("?")[0];
        $(this).html("<iframe src=https://player.twitch.tv/?channel=" +ytid+ "&parent=www.galaxypledges.net" + " frameborder='0' allowfullscreen='true' scrolling='no' height='378' width='620'></iframe><br />");
        });
     
      $('.postbody a[href*="twitch.tv"]').each(function() {
        var ytid = $(this).attr('href').split("twitch.tv/")[1].split("/")[0];
        $(this).html("<iframe src=https://player.twitch.tv/?channel=" +ytid+ "&parent=www.galaxypledges.net" + " frameborder='0' allowfullscreen='true' scrolling='no' height='378' width='620'></iframe><br />");
        });
     
      $('.postbody a[href*="twitch.tv"]').each(function() {
        var ytid = $(this).attr('href').split("twitch.tv/videos/")[1].split("?")[0];
        $(this).html("<iframe src=https://player.twitch.tv/?video=" +ytid+ "&parent=www.galaxypledges.net" + " frameborder='0' allowfullscreen='true' scrolling='no' height='378' width='620'></iframe><br />");
        });
    avatar
    Simone Boi
    Forumember


    Posts : 90
    Reputation : 2
    Language : Italian

    Twitch clips embed Empty Re: Twitch clips embed

    Post by Simone Boi December 19th 2020, 17:45

    Bump! All of them works, but not together.

    Only clips = works
    Only video = works
    Only channel = works
    Video & Channel works
    Clips with others = Don't
    avatar
    Simone Boi
    Forumember


    Posts : 90
    Reputation : 2
    Language : Italian

    Twitch clips embed Empty Re: Twitch clips embed

    Post by Simone Boi December 20th 2020, 20:47

    Bump!
    avatar
    Simone Boi
    Forumember


    Posts : 90
    Reputation : 2
    Language : Italian

    Twitch clips embed Empty Re: Twitch clips embed

    Post by Simone Boi December 21st 2020, 21:40

    Bump!
    avatar
    Simone Boi
    Forumember


    Posts : 90
    Reputation : 2
    Language : Italian

    Twitch clips embed Empty Re: Twitch clips embed

    Post by Simone Boi December 22nd 2020, 22:00

    Bump.

      Current date/time is September 22nd 2024, 19:35