xenomedia / xeno_hero

Drupal 8 module that creates a Hero Paragraphs bundle.
GNU General Public License v2.0
23 stars 18 forks source link

Add Option for Video Background #8

Open thejimbirch opened 7 years ago

thejimbirch commented 7 years ago

Instead of just a plain old image, why can't we have a video background?

This would be a good thing to add once Media is in core (Drupal 8.4)

preritmohan commented 7 years ago

I played with Slick paragraphs and Video embed field. However it comes back with player controls on the video tag which needs some workaround to hide the controls bar. If we can have something similar within Xeno Hero it would be really great. Autoplay and option to hide the controls by default.

thejimbirch commented 7 years ago

It's been a while since I have done video backgrounds, but will look into it.

If you are embedding from youtube, you can add parameters to the url to autoplay, hide controls, etc... Not sure if the Media embed module saves that or not. Will have to explore.

Reference: https://drupal.gatech.edu/handbook/embed-youtube-video-autoplay-looping-and-no-controls https://developers.google.com/youtube/player_parameters#autoplay

preritmohan commented 6 years ago

Hey Jim, any luck with video backgrounds with xeno?

thejimbirch commented 6 years ago

I've uploaded a new branch 8-video, which is a good start but not there yet.

Additions

Changes

To Dos

To Update

The easiest way to update would be to uninstall and reinstall the module. However, you would need to delete all of your xeno_hero bundles for this.

You could also import the following config files manually into your Drupal install, and then update the module, and clear the cache.

field.storage.paragraph.xeno_background_video.yml field.field.paragraph.xeno_hero.xeno_background_video.yml

Once we get all the kinks worked out, we may be able to write an update hook

thejimbirch commented 6 years ago

I have an example/test up at:

http://video-bootstrap-paragraphs.pantheonsite.io/testing-video

If you are going to use this in the mean time because the loops are not working, better to find a long video!

preritmohan commented 6 years ago

Great work! Thanks Jim. For adding videos apart from vimeo and youtube I have used https://www.drupal.org/project/video_embed_html5 module. This takes any video URL hosted anywhere.

For looping the video and getting autoplay to work (for iOS devices add playsinline attribute) I have overridden the player twig file that comes with the above module like this.

<video loop autoplay muted playsinline width="100%">
   <source src="{{ src }}" type="{{ type }}"/>
</video>

Thanks

thejimbirch commented 6 years ago

Which template is that in @preritmohan? The entity or the field?

preritmohan commented 6 years ago

It's video_embed_html5\templates\video-embed-html5.html.twig module

thejimbirch commented 6 years ago

Albert says: I was able to get the youtube video to loop. Just need to add the video id in the playlist parameter. http://www.youtube.com/v/VIDEO_ID?version=3&loop=1&playlist=VIDEO_ID. https://stackoverflow.com/questions/25779966/youtube-iframe-loop-doesnt-work