Skip to content

Commit

Permalink
v2.1 fix broken default values
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeyerstedt committed Apr 11, 2015
1 parent a3c1d8e commit f1b023d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# kirbytag html5video
by jtByt.Pictures, Jannik Beyerstedt from Hamburg, Germany
[jannik.beyerstedt.de](http://jannik.beyerstedt.de) | [Github](https://github.com/jbeyerstedt)
by Jannik Beyerstedt from Hamburg, Germany
[jannikbeyerstedt.de](http://jannikbeyerstedt.de) | [Github](https://github.com/jbeyerstedt)


## responsive html5 video player for lazy people
Expand Down
41 changes: 21 additions & 20 deletions html5video.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
/*
* kirbytag html5video
* html5 video player embedding for lazy people
*
*
* copyright: Jannik Beyerstedt | http://jannikbeyerstedt.de | [email protected]
* license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
*
* version 2.0 (03.11.2014)
* version 2.1 (06.04.2015)
* changelog:
* - v2.0: kirby 2 support
* - v2.1: fix broken default values
*/

kirbytext::$tags['html5video'] = array(
Expand All @@ -19,37 +20,37 @@
),
'html' => function($tag) {
$source = $tag->attr('html5video');

$baseurl = url('/video/');
$posterurl = $baseurl . urlencode($source) . '-poster.png';



if ($tag->attr('hls') == true) {


if ($tag->attr('hls') == null || $tag->attr('hls') == true ) {
$hlsurl = $baseurl . urlencode($source) . '-hls/' . urlencode($source) . '-index.m3u8';
$hlssource = '<source src="' . $hlsurl . '" type="application/x-mpegurl">';}
else {
$hlssource = "";}
if ($tag->attr('h264') == true) {

if ($tag->attr('hls') == null || $tag->attr('h264') == true) {
$mp4url = $baseurl . urlencode($source) . '-h264.mp4';
$mp4source = '<source src="' . $mp4url . '" type="video/mp4">';}
else {
$mp4source = "";}
if ($tag->attr('webm') == true) {
$webmurl = $baseurl . urlencode($source) . '-webm.webm';

if ($tag->attr('hls') == null || $tag->attr('webm') == true) {
$webmurl = $baseurl . urlencode($source) . '-webm.webm';
$webmsource = '<source src="' . $webmurl . '" type="video/webm">';}
else {
$webmsource = "";}

return '<video class=html5player controls="controls" poster="' . $posterurl . '" preload="none">' .
$hlssource .
$mp4source .


return '<video class=html5player controls="controls" poster="' . $posterurl . '" preload="none">' .
$hlssource .
$mp4source .
$webmsource .
'Dein Browser kann HTML5-Video nicht. Nimm eine aktuelle Version. Your browser does not support the video tag, choose an other browser.' .
'Dein Browser kann HTML5-Video nicht. Nimm eine aktuelle Version. Your browser does not support the video tag, choose an other browser.' .
'</video>';

}
);

);

0 comments on commit f1b023d

Please sign in to comment.