Skip to content

adding RTMP support #8

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 12 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
17 changes: 17 additions & 0 deletions help.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
<p>Use the <strong>Insert HTML5 Video</strong> button in the WordPress editor or use the [videojs] shortcode in your post or page using the following options:</p>

<h3>rtmp</h3>

<p>The location of the h.264/MP4 source for the video.</p>
<p>The connection and stream parts are determined by splitting the URL on the first ampersand (&) or the last slash (/).</p>
<p>http://myurl.com/streaming&/is/fun --><br />
connection: http://myurl.com/streaming<br />
stream: /is/fun<br />
<br />
-or-<br />
<br />
http://myurl.com/streaming/is/fun --><br />
connection: http://myurl.com/streaming/is<br />
stream: fun</p>

<pre><code>[videojs rtmp="rtmp://video-js.zencoder.com/oceans-clip.mp4"]
</code></pre>

<h3>mp4</h3>

<p>The location of the h.264/MP4 source for the video.</p>
Expand Down
7 changes: 7 additions & 0 deletions mce-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@

var form = jQuery('<div id="videoJSpopup">\
<table id="videoJStable" class="form-table">\
<tr>\
<th><label for="videojs-rtmp">RTMP Stream</label></th>\
<td><input type="text" name="videojs-rtmp" id="videojs-rtmp"><br>\
<small>The location of the h.264/MP4 stream for the video.</small></td>\
</tr>\
<tr>\
<th><label for="videojs-mp4">MP4 Source</label></th>\
<td><input type="text" name="videojs-mp4" id="videojs-mp4"><br>\
Expand Down Expand Up @@ -125,8 +130,10 @@
//text options
var options = {
'mp4' : '',
'rtmp' : '',
'webm' : '',
'ogg' : '',
'youtube' : '',
'poster' : '',
'width' : '',
'height' : '',
Expand Down
31 changes: 27 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== Video.js - HTML5 Video Player for Wordpress ===
Contributors: nosecreek, Steve Heffernan, schnere
Contributors: nosecreek, Steve Heffernan, schnere, Stanislav Chernenko
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
Tested up to: 4.1
Stable tag: 4.11.3
License: LGPLv3
License URI: http://www.gnu.org/licenses/lgpl-3.0.html

Expand All @@ -27,6 +27,22 @@ This section describes how to install the plugin and get it working.
##Video Shortcode Options
-------------------------

### rtmp
The location of the h.264/MP4 source for the video.
The connection and stream parts are determined by splitting the URL on the first ampersand (&) or the last slash (/).

http://myurl.com/streaming&/is/fun -->
connection: http://myurl.com/streaming
stream: /is/fun

-or-

http://myurl.com/streaming/is/fun -->
connection: http://myurl.com/streaming/is
stream: fun

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

### mp4
The location of the h.264/MP4 source for the video.

Expand Down Expand Up @@ -105,7 +121,7 @@ Text Tracks are a function of HTML5 video for providing time triggered text to t

### All Attributes Example

[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]
[videojs rtmp="rtmp://cp67126.edgefcs.net/ondemand/&mp4:mediapm/ovp/content/test/video/spacealonehd_sounas_640_300.mp4" 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.js Settings Screen
Expand All @@ -119,6 +135,13 @@ Uncheck the *Use the [video] shortcode?* option __only__ if you are using WordPr

== Changelog ==

= 4.11.3 =

* Updated to use Video.js 4.11.3
* Updated youtube tech to latest version (https://github.com/eXon/videojs-youtube)
* Change tech order if RTMP used to ['flash', 'html5'], defaults is ['html5','flash']
* Fixed tinymce button (shortcode for youtube have added later without src)

= 4.5.0 =

* Updated to use Video.js 4.5
Expand Down
47 changes: 20 additions & 27 deletions video-js.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
/**
* @package Video.js
* @version 4.5.0
* @version 4.11.3
*/
/*
Plugin Name: Video.js - HTML5 Video Player for WordPress
Plugin URI: http://videojs.com/
Description: Self-hosted responsive HTML5 video for WordPress, built on the widely used 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.
Author: <a href="http://www.nosecreekweb.ca">Dustin Lammiman</a>, <a href="http://steveheffernan.com">Steve Heffernan</a>
Version: 4.5.0
Version: 4.11.3
*/


Expand All @@ -31,8 +31,8 @@ function register_videojs(){
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_register_script( 'videojs', '//vjs.zencdn.net/4.11.3/video.js' );
wp_register_style( 'videojs', '//vjs.zencdn.net/4.11.3/video-js.css' );
wp_enqueue_style( 'videojs' );
} else { //use the self hosted version
wp_register_script( 'videojs', plugins_url( 'videojs/video.js' , __FILE__ ) );
Expand Down Expand Up @@ -70,28 +70,6 @@ function videojs_custom_colors() {
}
add_action( 'wp_head', 'videojs_custom_colors' );


/* Prevent mixed content warnings for the self-hosted version */
function add_videojs_swf(){
$options = get_option('videojs_options');
if($options['videojs_cdn'] != 'on') {
echo '
<script type="text/javascript">
if(typeof videojs != "undefined") {
videojs.options.flash.swf = "'. plugins_url( 'videojs/video-js.swf' , __FILE__ ) .'";
}
document.createElement("video");document.createElement("audio");document.createElement("track");
</script>
';
} else {
echo '
<script type="text/javascript"> document.createElement("video");document.createElement("audio");document.createElement("track"); </script>
';
}
}
add_action('wp_head','add_videojs_swf');


/* The [video] or [videojs] shortcode */
function video_shortcode($atts, $content=null){
add_videojs_header();
Expand All @@ -100,6 +78,7 @@ function video_shortcode($atts, $content=null){

extract(shortcode_atts(array(
'mp4' => '',
'rtmp' => '',
'webm' => '',
'ogg' => '',
'youtube' => '',
Expand All @@ -117,6 +96,11 @@ function video_shortcode($atts, $content=null){

$dataSetup = array();

// Use self hosted version of swf
if($options['videojs_cdn'] != 'on') {
$dataSetup['flash']['swf'] = plugins_url( 'videojs/video-js.swf' , __FILE__ );
}

// ID is required for multiple videos to work
if ($id == '')
$id = 'example_video_id_'.rand();
Expand All @@ -126,6 +110,14 @@ function video_shortcode($atts, $content=null){
$mp4_source = '<source src="'.$mp4.'" type=\'video/mp4\' />';
else
$mp4_source = '';

// RTMP Stream Supplied
if ($rtmp) {
$rtmp_source = '<source src="'.$rtmp.'" type=\'rtmp/mp4\' />';
$dataSetup['techOrder'] = array('flash', 'html5');
}
else
$rtmp_source = '';

// WebM Source Supplied
if ($webm)
Expand All @@ -141,7 +133,7 @@ function video_shortcode($atts, $content=null){

if ($youtube) {
$dataSetup['forceSSL'] = 'true';
$dataSetup['techOrder'] = array("youtube");
$dataSetup['techOrder'] = array('youtube');
$dataSetup['src'] = $youtube;
}
// Poster image supplied
Expand Down Expand Up @@ -199,6 +191,7 @@ function video_shortcode($atts, $content=null){

<!-- Begin Video.js -->
<video id="{$id}" class="video-js vjs-default-skin{$class}" width="{$width}" height="{$height}"{$poster_attribute}{$controls_attribute}{$preload_attribute}{$autoplay_attribute}{$loop_attribute}{$muted_attribute} data-setup='{$jsonDataSetup}'>
{$rtmp_source}
{$mp4_source}
{$webm_source}
{$ogg_source}{$track}
Expand Down
1 change: 1 addition & 0 deletions videojs/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
<track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
<track kind="subtitles" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
</video>

</body>
Expand Down
Binary file modified videojs/font/vjs.eot
Binary file not shown.
Loading