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.

Twitch clips embed

Go down

Twitch clips embed Empty Twitch clips embed

Post by Simone Boi December 18th 2020, 3:26 pm

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 : 92
Reputation : 2
Language : Italian

https://gamespledge.forumattivo.com/

Back to top Go down

Twitch clips embed Empty Re: Twitch clips embed

Post by Simone Boi December 19th 2020, 4:45 pm

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 : 92
Reputation : 2
Language : Italian

https://gamespledge.forumattivo.com/

Back to top Go down

Twitch clips embed Empty Re: Twitch clips embed

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

Bump!
avatar
Simone Boi
Forumember

Posts : 92
Reputation : 2
Language : Italian

https://gamespledge.forumattivo.com/

Back to top Go down

Twitch clips embed Empty Re: Twitch clips embed

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

Bump!
avatar
Simone Boi
Forumember

Posts : 92
Reputation : 2
Language : Italian

https://gamespledge.forumattivo.com/

Back to top Go down

Twitch clips embed Empty Re: Twitch clips embed

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

Bump.
avatar
Simone Boi
Forumember

Posts : 92
Reputation : 2
Language : Italian

https://gamespledge.forumattivo.com/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum