diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e54817 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ + +*.DS_Store + +.brackets.json +videojs/font/.DS_Store + +/vendor/ + +*.lock diff --git a/admin.php b/admin.php index d0fbaf9..1a50912 100644 --- a/admin.php +++ b/admin.php @@ -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 */ @@ -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'] = ''; } @@ -182,7 +187,18 @@ function reset_output() { if($options['videojs_reset']) { $checked = ' checked="checked" '; } else { $checked = ''; } echo ""; } +/* Plugins for videojs */ +function resolution_output() { + $options = get_option('videojs_options'); + if($options['videojs_resolution']) { $checked = ' checked="checked" '; } else { $checked = ''; } + echo ""; +} +function forceMobile_output() { + $options = get_option('videojs_options'); + if($options['videojs_forceMobile']) { $checked = ' checked="checked" '; } else { $checked = ''; } + echo ""; +} /* Set Defaults */ register_activation_hook(plugin_dir_path( __FILE__ ) . 'video-js.php', 'add_defaults_fn'); @@ -190,7 +206,7 @@ function reset_output() { 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"); } @@ -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 } } diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f53f8df --- /dev/null +++ b/composer.json @@ -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": "stopspazzing@gmail.com" + } + ], + "minimum-stability": "dev" +} diff --git a/help.html b/help.html index dad690d..9141752 100644 --- a/help.html +++ b/help.html @@ -28,6 +28,13 @@
[videojs youtube="http://www.youtube.com/watch?v=DJU6ppZAaec"]
+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"]
+
+
The location of the poster frame for the video.
diff --git a/mce-button.js b/mce-button.js index 7855055..a3a25d1 100644 --- a/mce-button.js +++ b/mce-button.js @@ -1,4 +1,4 @@ -(function() { +(function(){ tinymce.create('tinymce.plugins.VideoJS', { init: function(ed, url) { ed.addButton('videojs', { @@ -50,37 +50,42 @@\ - | \ + | \ The location of the h.264/MP4 source for the video. | \
---|---|---|
\ - | \ + | \ The location of the VP8/WebM source for the video. | \
\ - | \ + | \ The location of the Theora/Ogg source for the video. | \
\ - | \ + | \ The location of the YouTube source for the video. | \
\ + | \ + The location of the RTMP source for the video. | \
+ |
\ - | \ + | \ The location of the poster frame for the video. | \
\ - | \ + | \ The width of the video. | \
\ - | \ + | \ The height of the video. | \
\ | ||
\ + | \ | \ |
\ - | \ + | \ Add a custom ID to your video player. | \
\ - | \ + | \ Add a custom class to your player. Use full for floating the video player using \'alignleft\' or \'alignright\'. | \
+
\ + | \ + Add a watermark to your player. Default location is top left corner @ 50% opacity. \ + xpos= ypos= opacity= xrepeat=\ + + + | \
\ @@ -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) { diff --git a/readme.txt b/readme.md similarity index 82% rename from readme.txt rename to readme.md index 76595c0..476a3b5 100755 --- a/readme.txt +++ b/readme.md @@ -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. @@ -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. @@ -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 -------------------------- @@ -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 diff --git a/video-js.php b/video-js.php index 6bb2ca6..2170e0c 100755 --- a/video-js.php +++ b/video-js.php @@ -1,14 +1,14 @@ Dustin Lammiman, Steve Heffernan -Version: 4.5.0 +Version: 4.6.0 */ @@ -25,275 +25,301 @@ /* Register the scripts and enqueue css files */ function register_videojs(){ - $options = get_option('videojs_options'); - - wp_register_style( 'videojs-plugin', plugins_url( 'plugin-styles.css' , __FILE__ ) ); - wp_enqueue_style( 'videojs-plugin' ); - - if($options['videojs_cdn'] == 'on') { //use the cdn hosted version - wp_register_script( 'videojs', '//vjs.zencdn.net/4.5/video.js' ); - wp_register_style( 'videojs', '//vjs.zencdn.net/4.5/video-js.css' ); - wp_enqueue_style( 'videojs' ); - } else { //use the self hosted version - wp_register_script( 'videojs', plugins_url( 'videojs/video.js' , __FILE__ ) ); - wp_register_style( 'videojs', plugins_url( 'videojs/video-js.css' , __FILE__ ) ); - wp_enqueue_style( 'videojs' ); - } - - wp_register_script( 'videojs-youtube', plugins_url( 'videojs/vjs.youtube.js' , __FILE__ ) ); + $options = get_option('videojs_options'); + + wp_register_style( 'videojs-plugin', plugins_url( 'plugin-styles.css' , __FILE__ ) ); + wp_enqueue_style( 'videojs-plugin' ); + + if($options['videojs_cdn'] == 'on') { //use the cdn hosted version v4.12.6 + wp_register_script( 'videojs', '//vjs.zencdn.net/4.12.6/video.js' ); + wp_register_style( 'videojs', '//vjs.zencdn.net/4.12.6/video-js.css' ); + wp_enqueue_style( 'videojs' ); + } else { //use the self hosted version + wp_register_script( 'videojs', plugins_url( 'videojs/video.js' , __FILE__ ) ); + wp_register_style( 'videojs', plugins_url( 'videojs/video-js.css' , __FILE__ ) ); + wp_enqueue_style( 'videojs' ); + } + wp_register_script( 'videojs-youtube', plugins_url( 'videojs/vjs.youtube.js' , __FILE__ ) ); + if($options['videojs_resolution'] == 'on') { //add needed files for selecting video resolution + wp_register_script( 'videojs-resolution', plugins_url( 'videojs/video-quality-selector.js' , __FILE__ ) ); + wp_register_style( 'videojs-resolution', plugins_url( 'videojs/button-styles.css' , __FILE__ ) ); + wp_enqueue_style( 'videojs-resolution' ); + } + wp_register_script( 'videojs-watermark', plugins_url( 'videojs/videojs.watermark.js' , __FILE__ ) ); + wp_register_style( 'videojs-watermark', plugins_url( 'videojs/videojs.watermark.css' , __FILE__ ) ); + wp_enqueue_style( 'videojs-watermark' ); } add_action( 'wp_enqueue_scripts', 'register_videojs' ); - -/* Include the scripts before