Permalink
Switch branches/tags
Nothing to show
Find file Copy path
fdc2190 Feb 6, 2017
2 contributors

Users who have contributed to this file

@Sommerregen @magikcypress
145 lines (96 sloc) 7.58 KB

Grav MediaEmbed Plugin

Release Issues Dual license Flattr PayPal

This plugin embeds several media sites (e.g. YouTube, Vimeo, Soundcloud) by only providing the URL to the medium.

Table of Contents:

About

Grav MediaEmbed plugin is the official successor of Grav VideoEmbed plugin, allows to embed several media sites by only providing the URL to the medium and supports lazy loading techniques for videos and other media. Currently it supports

  • YouTube
  • Vimeo
  • DailyMotion
  • SoundCloud
  • Spotify
  • Flickr
  • Imgur
  • Instagram
  • GitHub
  • Twitter

but more services are coming soon! In principle it supports any service, which provides the oEmbed format. Media are embedded using the Markdown syntax for images (![Alt](URL "Title")), e.g. the below screenshot was created with the following code:

![](https://www.flickr.com/photos/chris_gin/6585842063)

Screenshot MediaEmbed Plugin

The Roadmap

Grav MediaEmbed plugin is neat and a powerful tool to embed other media types. However at the moment only a few services are supported. Further the configuration for the services may differ under certain circumstances; some may be more configurable than others. In future releases I intend to implement:

  • a unified interface for accessing OEmbed services
  • a cache mechanism for requests, data and images
  • support more than 200+ OEmbed services
  • and a more powerful API

If you have any ideas to extend the list, then please don't hesitate to open an issue and spread your idea with the community!

So far I'm happy that Grav MediaEmbed plugin becomes one of the most popular a d used plugins in a few days. Thank you! I try to give my best to provide you a fast, easy to use and extensible plugin. I have already spent a lot of time and will spend a lot of time even more. The plan is to extend Grav MediaEmbed plugin even more to embed arbitrary websites and embed media as cards (e.g. Wordpress, Twitter, Facebook, GitHub). This will however mean a many hour work and thus I plan to support such features in a paid version of Grav MediaEmbed plugin called "MediaEmbed Pro", which will coming soon. From then on, Grav MediaEmbed plugin will come in two flavors: a free version supporting all OEmbed services and a paid version with better embedding support of media and enabling the use of embed media cards.

Installation and Updates

Installing or updating the MediaEmbed plugin can be done in one of two ways. Using the GPM (Grav Package Manager) installation update method (i.e. bin/gpm install mediaembed) or manual install by downloading this plugin and extracting all plugin files to

user/plugins/mediaembed

For more informations, please check the Installation and update guide.

Usage

The MediaEmbed plugin comes with some sensible default configuration, that are pretty self explanatory:

Config Defaults

# Global plugin configurations

enabled: true                # Set to false to disable this plugin completely
built_in_css: true           # Use built-in CSS of the plugin
built_in_js: true            # Use built-in JS of the plugin

# Default options for MediaEmbed configuration.

# -- Media --
media:
  width: 640                 # Default media width
  height: 390                # Default media height including controls
  adjust: true               # Adjust media or keep default dimensions?

  preview: true              # Show or hide media preview
  responsive: false          # Allow media to be responsive
  protocol: "http://"        # Default protocol for remote media resources

services:
	<ServiceName>:
    enabled: true            # Set to false to disable this service completely
    type: <Type>             # Type of the media service

    # URL of media service used for embedding
    url: "www.domain.com/embed/{:id}"

    # Canonical URL of media service (used in endpoint calls)
    canonical: "http://www.domain.com/{:id}"

    # Endpoint to grab media informations
    endpoint: "http://www.domain.com/oembed?url={:canonical}&format=json"

    # Regex filters ("~REGEX~i") to grab media id
    schemes:
      - "domain.com/*"

    # Custom service-related media option overrides
    params:
      <Param>: <Value>

If you need to change any value, then the best process is to copy the mediaembed.yaml file into your users/config/plugins/ folder (create it if it doesn't exist), and then modify there. This will override the default settings.

Contributing

You can contribute at any time! Before opening any issue, please search for existing issues and review the guidelines for contributing.

After that please note:

  • If you find a bug, would like to make a feature request or suggest an improvement, please open a new issue. If you have any interesting ideas for additions to the syntax please do suggest them as well!
  • Feature requests are more likely to get attention if you include a clearly described use case.
  • If you wish to submit a pull request, please make again sure that your request match the guidelines for contributing and that you keep track of adding unit tests for any new or changed functionality.

Support and donations

If you like my project, feel free to support me via Flattr or by sending me some bitcoins to 1HQdy5aBzNKNvqspiLvcmzigCq7doGfLM4.

Thanks!

License

Copyright (c) 2017 Benjamin Regler. See also the list of contributors who participated in this project.

Dual-licensed for use under the terms of the MIT or GPLv3 licenses.

GNU license - Some rights reserved