This plugin convert links to videos from popular sharing services to embed format. Supported services:
This .md
page source:
Home
------------
## See this youtube video!
https://www.youtube.com/watch?v=rZudJiJcw3s
Will be converted to:
<h1>Home</h1>
<h2>See this youtube video!</h2>
<div>
<iframe src="https://github.com/maximkou/grav-plugin-videoembed/raw/master//youtube.com/embed/rZudJiJcw3s"></iframe>
</div>
There are two ways to install plugin:
(Recomended) Download the zip version of this repository and unzip it under /your/site/grav/user/plugins
. Then, rename the folder to videoembed
.
You should now have all the plugin files under /your/site/grav/user/plugins/videoembed
Simply add plugin dependency into .dependencies
file, e.g:
git:
videoembed:
url: https://github.com/maximkou/grav-plugin-videoembed.git
path: user/plugins/videoembed
branch: master
And then run php bin/grav install
All configuration rules located in videoembed.yaml
You can disable/enable plugin by changing enabled
option, example:
enabled: true # enabled: false for disable
Plugin support responsive
video size in 16:9 ratio. This option disabled by default.
Used this method for iframes.
responsive: false
By default, plugin wrap embed element into div.video-container
, you can change this behaviour by changing container
option.
container:
element: div # wrapper html element name
# wrapper element html attributes, like ID, class
html_attr:
class: video-container
If you have not use wrapper, remove or comment this directive.
Attention: Responsiveness option works only with defined container. If responsive
option enabled and container
is not defined - you got error.
All services configuration located in services
section of videoembed.yaml
.
Available options:
js
, css
) into page <HEAD>
block. Assets will be added, if service support enabled and if least one link to service was replaced.width: 0
will create <iframe width="0">...</iframe>
VideoJS
))VideoJS
): video options, see more hereDefault services configuration:
You can see default services configuration in videoembed.yaml file.
If you need set custom plugin parameters for single page, set plugin parameters in page header in section videoembed
, e.g:
---
# ... more headers
videoembed:
services:
youtube:
embed_options:
fs: 2
---
You can override default embed_options
for each video, for do this simply add params to end of video url. Your params will be applied on default embed options.
Example (using default options), link
http://youtu.be/AsdjHDHksdf?autoplay=0&wmode=transparent
will be converted to something like this:
<div class="video-container">
<iframe src="https://github.com/maximkou/grav-plugin-videoembed/raw/master//youtube.com/embed/AsdjHDHksdf?autoplay=0&rel=0&hd=1&vq=hd1080&wmode=transparent"></iframe>
</div>
The MIT License (MIT)
Copyright (c) 2014 Maxim Hodyrev
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.