getgrav / grav-plugin-youtube

Grav YouTube Plugin
https://getgrav.org
MIT License
23 stars 12 forks source link

Loop parameter not working in HTML5 player #24

Open michalhudecek opened 6 years ago

michalhudecek commented 6 years ago

To make loop working in embed videos, the playlist parameter has to be set to the same youtube video.

See loop in https://developers.google.com/youtube/player_parameters

Note: This parameter has limited support in the AS3 player and in IFrame embeds, which could load either the AS3 or HTML5 player. Currently, the loop parameter only works in the AS3 player when used in conjunction with the playlist parameter. To loop a single video, set the loop parameter value to 1 and set the playlist parameter value to the same video ID already specified in the Player API URL:

michalhudecek commented 6 years ago

There is an easy fix for this issue. I wanted to create a pull request but looks like I don't have permissions. Here is the code that needs to be added to classes/Twig/YoutubeTwigExtension.php on line 56

//YouTube loop fix for HTML5 player
if ($key == 'loop' && $value == 1) {
    $filtered_player_parameters['playlist'] = $video_id;
}
DerTFL commented 6 years ago

michalhudecek, Thanks! All work now.

michalhudecek commented 4 years ago

This should be a very easy pull request. Any fix in sight?

rhukster commented 4 years ago

Anyone can create a pull request, you can simply navigate to the file in github and click edit. Then when you save it automatically creates a pull request.

michalhudecek commented 4 years ago

Oh. Ok. I tried to do it directly from git without success. Here it is: https://github.com/getgrav/grav-plugin-youtube/pull/36

mahagr commented 4 years ago

Looks like this one can be closed now?

michalhudecek commented 4 years ago

Was it released to production?