In TwitchClip.php the function renderEmbedCode has an unused variable $autoplay. The variable itself is empty.

I'm short on time for now so as a workaround I've added autoplay=true to the url but figured I'd report it for now.

'#url' => sprintf('https://clips.twitch.tv/embed?clip=%s&parent=%s', $this->getVideoId(), $this->request->getHost()),

becomes

'#url' => sprintf('https://clips.twitch.tv/embed?clip=%s&parent=%s&autoplay=true', $this->getVideoId(), $this->request->getHost()),

CommentFileSizeAuthor
#2 3195586-2.patch772 bytesmohit.bansal623

Comments

bigmonmulgrew created an issue. See original summary.

mohit.bansal623’s picture

Status: Active » Needs review
StatusFileSize
new772 bytes

As suggested, autoplay has been added in url as per the solution, can't we remove that autoplay from the parameters but I think that will break the functionality of the module.

fdverwoerd’s picture

Hello Mohit, bigmonmulgrew,

I understand the variable is not used. But empty? That should not be? When did this happen?

If I dump the following it's either false or true based on your view mode settings.

/**
* {@inheritdoc}
*/
public function renderEmbedCode($width, $height, $autoplay) {
var_dump($width);
var_dump($height);
var_dump($autoplay);
die;

I get something like int(854) int(480) bool(false) back.

I guess we could add autoplay because some twitch providers support that.

https://dev.twitch.tv/docs/embed/video-and-clips

return [
      '#type' => 'video_embed_iframe',
      '#provider' => 'twitch_clip',
      '#url' => sprintf('https://clips.twitch.tv/embed?clip=%s&parent=%s&autoplay=%s', $this->getVideoId(), $this->request->getHost(), $autoplay),