Skip to content

Commit

Permalink
update version number and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestecker committed Apr 12, 2018
1 parent be3dbdd commit 59ddb17
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .craftplugin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"pluginName":"Video Embedder","pluginDescription":"Craft plugin to generate an embed URL from a YouTube or Vimeo URL.","pluginVersion":"1.0.8","pluginAuthorName":"Mike Stecker","pluginVendorName":"mikestecker","pluginAuthorUrl":"http://github.com/mikestecker","pluginAuthorGithub":"mikestecker","codeComments":"yes","pluginComponents":["variables"],"consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"}
{"pluginName":"Video Embedder","pluginDescription":"Craft plugin to generate an embed URL from a YouTube or Vimeo URL.","pluginVersion":"1.0.9","pluginAuthorName":"Mike Stecker","pluginVendorName":"mikestecker","pluginAuthorUrl":"http://github.com/mikestecker","pluginAuthorGithub":"mikestecker","codeComments":"yes","pluginComponents":["variables"],"consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.0.9 - 2018-04-12
### Added
- Added `getVideoId` variable
### Changed
- Code cleanup
- Updated functions to return an empty string if the URL returns null for any reason. (#5, #6)
- Craft 3.0.0 release is required, no longer supporting RC versions

## 1.0.8 - 2018-03-07
### Added
- Added `getTitle` variable
Expand Down
49 changes: 41 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Ported over from [Viget's](https://viget.com) [Video Embed plugin for Craft 2.x]

## Requirements

This plugin requires Craft CMS 3.0.0-RC1 or later.
This plugin requires Craft CMS 3.0.0 or later.

## Installation

Expand All @@ -25,16 +25,24 @@ Video Embedder will take your YouTube or Vimeo URL's and convert the URL into an

## Using Video Embedder

Pass a YouTube or Vimeo URL to the `getEmbedUrl` variable and an embed URL will be returned.
Pass a YouTube or Vimeo URL to the `getEmbedUrl` variable and an embed URL will be returned. The plugin will check if the URL is valid and allows embedding. If it doesn't, it will return an empty string.

```
{{ craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254') }}
{% set embed = craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254') %}
{% if embed | length %}
{{ embed }}
{% endif %}
```

**Example:**

```
<iframe src="{{ craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254') }}"></iframe>
{% set embed = craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254') %}
{% if embed | length %}
<iframe src="{{ embed }}"></iframe>
{% endif %}
```

**Output:**
Expand All @@ -50,15 +58,19 @@ ___
`getEmbedUrl` will now accept optional parameters to YouTube and Vimeo URL's such as `autoplay`, `rel`, etc:

```
{{ craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254', {autoplay: 1, rel: 0, theme: 'dark'}) }}
{% set embed = craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254', {autoplay: 1, rel: 0, theme: 'dark'}) %}
```

___

Video Embedder will also pull the largest thumbnail URL from YouTube or Vimeo using the `getVideoThumbnail` variable.

```
{{ craft.videoEmbedder.getVideoThumbnail('https://www.youtube.com/watch?v=6xWpo5Dn254') }}
{% set thumbnail = craft.videoEmbedder.getVideoThumbnail('https://www.youtube.com/watch?v=6xWpo5Dn254') %}
{% if thumbnail | length %}
{{ thumbnail }}
{% endif %}
```

**Output:**
Expand All @@ -75,16 +87,37 @@ Video Embedder will now generate the iframe code. Simple use the `embed` variabl

Basic example:
```
{{ craft.videoEmbedder.embed('https://www.youtube.com/watch?v=6xWpo5Dn254') }}
{% set embed = craft.videoEmbedder.embed('https://www.youtube.com/watch?v=6xWpo5Dn254') %}
{% if embed | length %}
{{ embed }}
{% endif %}
```

With parameters:
```
{{ craft.videoEmbedder.embed('https://www.youtube.com/watch?v=6xWpo5Dn254', {autoplay: 1, rel: 0, theme: 'dark'}) }}
{% set embed = craft.videoEmbedder.embed('https://www.youtube.com/watch?v=6xWpo5Dn254', {autoplay: 1, rel: 0, theme: 'dark'}) %}
```

These parameters will simply output at the end of the embed URL string and have only been tested with YouTube and Vimeo. Check with each provider for which parameters are supported.

___

***New in 1.0.9:***

Return only the Vimeo or YouTube ID from the URL. This is helpful in use cases such as using it with [Plyr](https://github.com/sampotts/plyr/)

Basic example:
```
{% set videoUrl = 'https://www.youtube.com/watch?v=6xWpo5Dn254' %}
{% set videoId = craft.videoEmbedder.getVideoId(videoUrl) %}
{% set providerName = craft.videoEmbedder.getProviderName(videoUrl) %}
{% if videoId | length %}
<div id="player" data-plyr-provider="{{ providerName | lower }}" data-plyr-embed-id="{{ videoId }}"></div>
{% endif %}
```


## Video Embedder Roadmap

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mikestecker/craft-videoembedder",
"description": "Craft plugin to generate an embed URL from a YouTube or Vimeo URL.",
"type": "craft-plugin",
"version": "1.0.8",
"version": "1.0.9",
"keywords": [
"craft",
"cms",
Expand All @@ -22,7 +22,7 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-RC1",
"craftcms/cms": "^3.0.0",
"embed/embed": "^3.3"
},
"repositories": [
Expand Down

0 comments on commit 59ddb17

Please sign in to comment.