Skip to content

Bug fixes, RTMP support, Res. Selector Plugin added, cleaned up code #10

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

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0f56382
added videojs-resolution
stopspazzing Mar 29, 2015
edb980e
Updated videojs + bug fixes to resolution selector
stopspazzing Mar 30, 2015
d5b37de
fixed res selector and added forcemobile
stopspazzing May 11, 2015
b5cdbad
stupid mac
stopspazzing May 11, 2015
d4a6483
die!
stopspazzing May 11, 2015
f9236f5
new videos version + bug fix
stopspazzing May 11, 2015
3a1008d
updated readme
stopspazzing May 11, 2015
5927386
removed useless coding
stopspazzing May 11, 2015
66dc252
should used proper read file
stopspazzing May 11, 2015
dd2478f
markup issues
stopspazzing May 11, 2015
e418201
proper markup
stopspazzing May 11, 2015
eb856f6
Merge remote-tracking branch 'origin/master'
stopspazzing May 11, 2015
9c63867
mark up fixes
stopspazzing May 11, 2015
1f4eb38
fixed small video res selector bug
stopspazzing May 11, 2015
0e072d0
bug fixes
stopspazzing May 11, 2015
4d66621
Cleaned up code
stopspazzing May 11, 2015
f021857
Added RTMP and bug fixes
stopspazzing May 12, 2015
2bbb3c4
updated help/readme with rtmp
stopspazzing May 12, 2015
fdecf80
totally ugly without correct extension
stopspazzing May 12, 2015
8dde8cd
youtube.js to head and watermark plugin added
stopspazzing May 13, 2015
7f1038e
small fix for ACF plugin
stopspazzing May 15, 2015
81cdde1
wrong js file name
celsoazevedo May 20, 2015
e11ee98
Merge pull request #1 from celsoazevedo/master
stopspazzing May 20, 2015
645331c
Class for responsive styling
stopspazzing May 28, 2015
e7ce3d4
Test for composer.json
stopspazzing May 28, 2015
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

*.DS_Store

.brackets.json
videojs/font/.DS_Store

/vendor/

*.lock
21 changes: 18 additions & 3 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ function register_videojs_settings() {
add_settings_field('videojs_video_shortcode', 'Use the [video] shortcode?', 'video_shortcode_output', 'videojs-settings', 'videojs_defaults');

add_settings_field('videojs_reset', 'Restore defaults upon plugin deactivation/reactivation', 'reset_output', 'videojs-settings', 'videojs_defaults');
/* New Plugins Settings */
add_settings_field('videojs_resolution', 'Enable video resolution selection? (uses videojs-resolution)', 'resolution_output', 'videojs-settings', 'videojs_defaults');
add_settings_field('videojs_forceMobile', 'Force mobile custom controls?', 'forceMobile_output', 'videojs-settings', 'videojs_defaults');
}

/* Validate our inputs */
Expand All @@ -90,7 +93,9 @@ function videojs_options_validate($input) {
$newinput['videojs_color_three'] = $input['videojs_color_three'];
$newinput['videojs_reset'] = $input['videojs_reset'];
$newinput['videojs_video_shortcode'] = $input['videojs_video_shortcode'];

// new plugin validations
$newinput['videojs_resolution'] = $input['videojs_resolution'];
$newinput['videojs_forceMobile'] = $input['videojs_forceMobile'];
if(!preg_match("/^\d+$/", trim($newinput['videojs_width']))) {
$newinput['videojs_width'] = '';
}
Expand Down Expand Up @@ -182,15 +187,26 @@ function reset_output() {
if($options['videojs_reset']) { $checked = ' checked="checked" '; } else { $checked = ''; }
echo "<input ".$checked." id='videojs_reset' name='videojs_options[videojs_reset]' type='checkbox' />";
}
/* Plugins for videojs */

function resolution_output() {
$options = get_option('videojs_options');
if($options['videojs_resolution']) { $checked = ' checked="checked" '; } else { $checked = ''; }
echo "<input ".$checked." id='videojs_resolution' name='videojs_options[videojs_resolution]' type='checkbox' />";
}
function forceMobile_output() {
$options = get_option('videojs_options');
if($options['videojs_forceMobile']) { $checked = ' checked="checked" '; } else { $checked = ''; }
echo "<input ".$checked." id='videojs_forceMobile' name='videojs_options[videojs_forceMobile]' type='checkbox' />";
}

/* Set Defaults */
register_activation_hook(plugin_dir_path( __FILE__ ) . 'video-js.php', 'add_defaults_fn');

function add_defaults_fn() {
$tmp = get_option('videojs_options');
if(($tmp['videojs_reset']=='on')||(!is_array($tmp))) {
$arr = array("videojs_height"=>"264","videojs_width"=>"640","videojs_preload"=>"","videojs_autoplay"=>"","videojs_responsive"=>"","videojs_cdn"=>"on","videojs_color_one"=>"#ccc","videojs_color_two"=>"#66A8CC","videojs_color_three"=>"#000","videojs_video_shortcode"=>"on","videojs_reset"=>"");
$arr = array("videojs_height"=>"264","videojs_width"=>"640","videojs_preload"=>"","videojs_autoplay"=>"","videojs_responsive"=>"","videojs_cdn"=>"on","videojs_color_one"=>"#ccc","videojs_color_two"=>"#66A8CC","videojs_color_three"=>"#000","videojs_video_shortcode"=>"on","videojs_reset"=>"","videojs_resolution"=>"","videojs_forceMobile"=>"");
update_option('videojs_options', $arr);
update_option("videojs_db_version", "1.0");
}
Expand All @@ -211,7 +227,6 @@ function update_videojs() {
$options['videojs_video_shortcode'] = "on";

update_option('videojs_options', $options);

update_option("videojs_db_version", $videojs_db_version); //Update the database version setting
}
}
Expand Down
16 changes: 16 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "stopspazzing/video-js-for-wordpress",
"description": "A video plugin for WordPress built on the Video.js HTML5 video player library. Allows you to embed video in your post or page using HTML5 with Flash fallback support for non-HTML5 browsers.",
"type": "wordpress-plugin",
"require": {
"php": "^5.4"
},
"license": "LGPLv3",
"authors": [
{
"name": "Jeremy Zimm",
"email": "[email protected]"
}
],
"minimum-stability": "dev"
}
7 changes: 7 additions & 0 deletions help.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ <h3>youtube</h3>
<pre><code>[videojs youtube="http://www.youtube.com/watch?v=DJU6ppZAaec"]
</code></pre>

<h3>rtmp</h3>

<p>The location of the rtmp source for the video.</p>

<pre><code>[videojs rtmp="rtmp://cp67126.edgefcs.net/ondemand/&mp4:mediapm/ovp/content/test/video/spacealonehd_sounas_640_300.mp4"]
</code></pre>

<h3>poster</h3>

<p>The location of the poster frame for the video.</p>
Expand Down
44 changes: 32 additions & 12 deletions mce-button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function() {
(function(){
tinymce.create('tinymce.plugins.VideoJS', {
init: function(ed, url) {
ed.addButton('videojs', {
Expand Down Expand Up @@ -50,37 +50,42 @@
<table id="videoJStable" class="form-table">\
<tr>\
<th><label for="videojs-mp4">MP4 Source</label></th>\
<td><input type="text" name="videojs-mp4" id="videojs-mp4"><br>\
<td><input type="text" name="videojs-mp4" id="videojs-mp4"><br/>\
<small>The location of the h.264/MP4 source for the video.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-webm">WebM Source</label></th>\
<td><input type="text" name="videojs-webm" id="videojs-webm"><br>\
<td><input type="text" name="videojs-webm" id="videojs-webm"><br/>\
<small>The location of the VP8/WebM source for the video.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-ogg">OGG Source</label></th>\
<td><input type="text" name="videojs-ogg" id="videojs-ogg"><br>\
<td><input type="text" name="videojs-ogg" id="videojs-ogg"><br/>\
<small>The location of the Theora/Ogg source for the video.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-youtube">YouTube Url</label></th>\
<td><input type="text" name="videojs-youtube" id="videojs-youtube"><br>\
<td><input type="text" name="videojs-youtube" id="videojs-youtube"><br/>\
<small>The location of the YouTube source for the video.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-rtmp">RTMP Source</label></th>\
<td><input type="text" name="videojs-rtmp" id="videojs-rtmp"><br/>\
<small>The location of the RTMP source for the video.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-poster">Poster Image</label></th>\
<td><input type="text" name="videojs-poster" id="videojs-poster"><br>\
<td><input type="text" name="videojs-poster" id="videojs-poster"><br/>\
<small>The location of the poster frame for the video.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-width">Width</label></th>\
<td><input type="text" name="videojs-width" id="videojs-width"><br>\
<td><input type="text" name="videojs-width" id="videojs-width"><br/>\
<small>The width of the video.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-height">Height</label></th>\
<td><input type="text" name="videojs-height" id="videojs-height"><br>\
<td><input type="text" name="videojs-height" id="videojs-height"><br/>\
<small>The height of the video.</small></td>\
</tr>\
<tr>\
Expand All @@ -96,18 +101,26 @@
<td><input id="videojs-loop" name="videojs-loop" type="checkbox" /></td>\
</tr>\
<tr>\
<th><label for="videojs-controls">Show Player Controls</label></th>\
<th><label for="videojs-controls">Show Player Controls</label></th/>\
<td><input id="videojs-controls" name="videojs-controls" type="checkbox" checked /></td>\
</tr>\
<tr>\
<th><label for="videojs-id">ID</label></th>\
<td><input type="text" name="videojs-id" id="videojs-id"><br>\
<td><input type="text" name="videojs-id" id="videojs-id"><br/>\
<small>Add a custom ID to your video player.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-class">Class</label></th>\
<td><input type="text" name="videojs-class" id="videojs-class"><br>\
<td><input type="text" name="videojs-class" id="videojs-class"><br/>\
<small>Add a custom class to your player. Use full for floating the video player using \'alignleft\' or \'alignright\'.</small></td>\
<tr>\
<th><label for="videojs-watermark">Add Watermark</label></th>\
<td><input type="text" name="videojs-watermark" id="videojs-watermark"><br/>\
<small>Add a watermark to your player. Default location is top left corner @ 50% opacity.</small><br/>\
xpos=<input type="text" name="videojs-wmxpos" id="videojs-wmxpos"> ypos=<input type="text" name="videojs-wmypos" id="videojs-wmypos"> opacity=<input type="text" name="videojs-wmopacity" id="videojs-wmopacity"> xrepeat=<input type="text" name="videojs-wmxrepeat" id="videojs-wmxrepeat"<br/>\


</td>\
</tr>\
</table>\
<p class="submit">\
Expand All @@ -127,11 +140,18 @@
'mp4' : '',
'webm' : '',
'ogg' : '',
'youtube' : '',
'rtmp' : '',
'poster' : '',
'width' : '',
'height' : '',
'id' : '',
'class' : ''
'class' : '',
'watermark': '',
'wmxpos' : '0',
'wmypos' : '0',
'wmxrepeat': '0',
'wmopacity': '0.5'
};

for(var index in options) {
Expand Down
48 changes: 37 additions & 11 deletions readme.txt → readme.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
=== Video.js - HTML5 Video Player for Wordpress ===
Contributors: nosecreek, Steve Heffernan, schnere
Donate link: http://ncrk.ca/videojs
Tags: html5, video, player, javascript
Requires at least: 2.7
Tested up to: 3.9
Stable tag: 4.5.0
License: LGPLv3
License URI: http://www.gnu.org/licenses/lgpl-3.0.html
# Video.js - HTML5 Video Player for Wordpress
Contributors: nosecreek, Steve Heffernan, schnere, stopspazzing
Donate link: http://ncrk.ca/videojs
Tags: html5, video, player, javascript
Requires at least: 2.7
Tested up to: 4.2.2
Stable tag: 4.6.1
License: LGPLv3
License URI: http://www.gnu.org/licenses/lgpl-3.0.html

Self-hosted responsive HTML5 video for WordPress, built on the widely used Video.js HTML5 video player. Embed video in your post or page using HTML5.

== Description ==
## Description

A video plugin for WordPress built on the Video.js HTML5 video player library. Allows you to embed video in your post or page using HTML5 with Flash fallback support for non-HTML5 browsers.

View [videojs.com](http://videojs.com) for additional information.

== Installation ==
## Installation

This section describes how to install the plugin and get it working.

Expand Down Expand Up @@ -47,6 +47,11 @@ The location of the YouTube source for the video.

[videojs youtube="http://www.youtube.com/watch?v=DJU6ppZAaec"]

### rtmp
The location of the RTMP source for the video.

[videojs rtmp="rtmp://cp67126.edgefcs.net/ondemand/&mp4:mediapm/ovp/content/test/video/spacealonehd_sounas_640_300.mp4"]

### poster
The location of the poster frame for the video.

Expand Down Expand Up @@ -107,6 +112,10 @@ Text Tracks are a function of HTML5 video for providing time triggered text to t

[videojs mp4="http://video-js.zencoder.com/oceans-clip.mp4" ogg="http://video-js.zencoder.com/oceans-clip.ogg" webm="http://video-js.zencoder.com/oceans-clip.webm" poster="http://video-js.zencoder.com/oceans-clip.png" preload="auto" autoplay="true" width="640" height="264" id="movie-id" class="alignleft" controls="false" muted="true"][track kind="captions" src="http://example.com/path/to/captions.vtt" srclang="en" label="English" default="true"][/videojs]

### Video Resolution Selector
Allows you to use multiple video resolution sources, currently for mp4's only tho should work for anything. The first res will be the default. Make sure each mp4# matches res#

[videojs mp41="http://video-js.zencoder.com/oceans-clip360p.mp4" mp42="http://video-js.zencoder.com/oceans-clip720p.mp4" mp43="http://video-js.zencoder.com/oceans-clip1080p.mp4" res1="360" res2="720" res3="1080"]

##Video.js Settings Screen
--------------------------
Expand All @@ -119,6 +128,23 @@ Uncheck the *Use the [video] shortcode?* option __only__ if you are using WordPr

== Changelog ==

= 4.6.2 =

* Moving youtube.js to head fixes several issues with youtube player
* Added watermark plugin with shortcode

= 4.6.1 =

* Simplified video output code and cleaned up unnecessary conditions
* Fixed Youtube bug in MCE that would prevent youtube url's from being added to the generated shorcode
* Added RTMP video source option in MCE and shortcode

= 4.6.0 =

* Updated to use Video.js 4.12.6
* Added Video Resolution Selector plugin
* Added option to force mobile custom controls

= 4.5.0 =

* Updated to use Video.js 4.5
Expand Down
Loading