NAME

Statocles::Plugin::VideoTag - Change video file anchors to video elements

VERSION

version 0.0400

SYNOPSIS

# site.yml
site:
  class: Statocles::Site
  args:
      plugins:
          video_tag:
              $class: Statocles::Plugin::VideoTag
              $args:
                   file_type: 'youtu'
                   width: 500
                   height: 300

DESCRIPTION

Statocles::Plugin::VideoTag changes video file anchor elements to video elements.

ATTRIBUTES

file_type

The file type to replace.

Default: mp4

width

Width of the iframe for an embedded YouTube video.

Default: 560

height

Height of the iframe for an embedded YouTube video.

Default: 315

frameborder

Whether to have a frameborder on the iframe for a YouTube video.

Default: 0

allow

The iframe allow attribute string for a YouTube video.

Default: accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture

allowfullscreen

Whether to allow full-screen for the iframe for a YouTube video.

Default: 1

METHODS

video_tag

$page = $plugin->video_tag($page);

Process the video links on a Statocles::Page.

If the file_type is given as youtu, YouTube links of this exact form will be converted to an embedded iframe:

https://www.youtube.com/watch?v=abcdefg1234567

Where the abcdefg1234567 is a placeholder for the actual video.

* Currently, including a YouTube start time (e.g. &t=42) in the link is not honored. In fact including any argument other than v will not render the embedded video correctly at this time.

register

Register this plugin to install its event handlers. (This method is called automatically.)

SEE ALSO

Statocles

Statocles::Plugin

Statocles::Plugin::AudioTag

https://ology.github.io/2020/12/06/making-a-statocles-plugin/

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Gene Boggs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.