-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3c1d8e
commit f1b023d
Showing
2 changed files
with
23 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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( | ||
|
@@ -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>'; | ||
|
||
} | ||
); | ||
|
||
); |