Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wistia Support #20

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ About YouTube options, please refer to https://developers.google.com/youtube/pla

About Vimeo options, please refer to https://developer.vimeo.com/apis/oembed

About Wistia options, please refer to https://wistia.com/support/developers/embed-options#options-list

<table style="min-width:100%;">
<tbody><tr>
<th colspan="2">properties</th>
Expand Down Expand Up @@ -215,6 +217,83 @@ About Vimeo options, please refer to https://developer.vimeo.com/apis/oembed
<td>xhtml</td>
<td>false</td>
</tr>
<tr>
<td rowspan="19">Wistia</td>
<td>autoPlay</td>
<td>false</td>
</tr>
<tr>
<td>controlsVisibleOnLoad</td>
<td>true</td>
</tr>
<tr>
<td>doNotTrac</td>
<td>true</td>
</tr>
<tr>
<td>endVideoBehavior</td>
<td>"default"</td>
</tr>
<tr>
<td>fullscreenButton</td>
<td>true</td>
</tr>
<tr>
<td>googleAnalytics</td>
<td>false</td>
</tr>
<tr>
<td>muted</td>
<td>false</td>
</tr>
<tr>
<td>playbackRateControl</td>
<td>true</td>
</tr>
<tr>
<td>playbar</td>
<td>true</td>
</tr>
<tr>
<td>playButton</td>
<td>true</td>
</tr>
<tr>
<td>playerColor</td>
<td>"5BB9FB"</td>
</tr>
<tr>
<td>qualityControl</td>
<td>true</td>
</tr>
<tr>
<td>settingsControl</td>
<td>true</td>
</tr>
<tr>
<td>silentAutoPlay</td>
<td>'allow'</td>
</tr>
<tr>
<td>smallPlayButton</td>
<td>true</td>
</tr>
<tr>
<td>videoFoam</td>
<td>true</td>
</tr>
<tr>
<td>volume</td>
<td>1</td>
</tr>
<tr>
<td>volumeControl</td>
<td>true</td>
</tr>
<tr>
<td>branding</td>
<td>false</td>
</tr>
<tr>
<td colspan="2">ratio</td>
<td>'16:9'</td>
Expand Down
49 changes: 48 additions & 1 deletion js/jquery-modal-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* license: appleple
* author: appleple
* homepage: http://developer.a-blogcms.jp
* version: 2.3.1
* version: 2.3.2
*
* custom-event-polyfill:
* license: MIT (http://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -161,6 +161,27 @@ var assign = require('es6-object-assign').assign;
var defaults = {
channel: 'youtube',
facebook: {},
wistia: {
autoPlay: false,
controlsVisibleOnLoad: true,
doNotTrac: true,
endVideoBehavior: "default",
fullscreenButton: true,
googleAnalytics: false,
muted: false,
playbackRateControl: true,
playbar: true,
playButton: true,
playerColor: "5BB9FB",
qualityControl: true,
settingsControl: true,
silentAutoPlay: 'allow',
smallPlayButton: true,
videoFoam: true,
volume: 1,
volumeControl: true,
branding: false
},
youtube: {
autoplay: 1,
cc_load_policy: 1,
Expand Down Expand Up @@ -233,6 +254,7 @@ var ModalVideo = function () {
var speed = opt.animationSpeed;
[].forEach.call(selectors, function (selector) {
selector.addEventListener('click', function () {
(0, _util.addClass)(body, 'modal-video-opened');
var videoId = selector.dataset.videoId;
var channel = selector.dataset.channel || opt.channel;
var id = (0, _util.getUniqId)();
Expand All @@ -244,6 +266,7 @@ var ModalVideo = function () {
modal.focus();
modal.addEventListener('click', function () {
(0, _util.addClass)(modal, classNames.modalVideoClose);
(0, _util.removeClass)(body, 'modal-video-opened');
setTimeout(function () {
(0, _util.remove)(modal);
selector.focus();
Expand Down Expand Up @@ -294,6 +317,8 @@ var ModalVideo = function () {
return this.getVimeoUrl(opt.vimeo, videoId);
} else if (channel === 'facebook') {
return this.getFacebookUrl(opt.facebook, videoId);
} else if (channel === 'wistia') {
return this.getWistiaUrl(opt.wistia, videoId);
}
return '';
}
Expand All @@ -318,6 +343,11 @@ var ModalVideo = function () {
value: function getFacebookUrl(facebook, videoId) {
return '//www.facebook.com/v2.10/plugins/video.php?href=https://www.facebook.com/facebook/videos/' + videoId + '&' + this.getQueryString(facebook);
}
}, {
key: 'getWistiaUrl',
value: function getWistiaUrl(wistia, videoId) {
return '//fast.wistia.com/embed/medias/' + videoId + '?' + this.getQueryString(wistia);
}
}, {
key: 'getHtml',
value: function getHtml(opt, videoUrl, id) {
Expand Down Expand Up @@ -381,4 +411,21 @@ var triggerEvent = exports.triggerEvent = function triggerEvent(el, eventName, o
el.dispatchEvent(event);
};

var removeClass = exports.removeClass = function removeClass(element, className) {
if (element.classList) {
element.classList.remove(className);
} else if (hasClass(element, className)) {
var reg = new RegExp('(\\s|^)' + className + '(\\s|$)');
element.className = element.className.replace(reg, ' ');
}
};

var hasClass = exports.hasClass = function hasClass(element, className) {
if (element.classList) {
return element.classList.contains(className);
} else {
return !!element.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
}
};

},{}]},{},[3]);
4 changes: 2 additions & 2 deletions js/jquery-modal-video.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading