com web/pres2: movie support in pres2reveal: display.php pres2reveal

[email protected] (Rasmus Lerdorf) Fri, 02 Mar 2018 20:54:02 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    e7e33d7e85e373be9c9a54ec0a82d199ae0055d9
Author:    Rasmus Lerdorf <[email protected]>         Fri, 2 Mar 2018 21:54:02 +0100
Parents:   9f55fdf37fc7dd6ba9307ede57fe6d7916c6c2d6
Branches:  master

Link:       http://git.php.net/?p=web/pres2.git;a=commitdiff;h=e7e33d7e85e373be9c9a54ec0a82d199ae0055d9

Log:
movie support in pres2reveal

Changed paths:
  M  display.php
  M  pres2reveal


Diff:
diff --git a/display.php b/display.php
index de533c3..6cf5265 100644
--- a/display.php
+++ b/display.php
@@ -2028,7 +2028,7 @@ class pdf extends display {
     function _divide(&$divide) { /* empty */ }
 
     function _movie(&$movie) { /* empty */ }
-    
+
     function _footer(&$footer) {        
         if($this->objs[1]->template != 'titlepage') {
             $this->my_pdf_page_number($this->pdf, $this->pdf_x, $this->pdf_y);
diff --git a/pres2reveal b/pres2reveal
index 12cf41c..53526c8 100755
--- a/pres2reveal
+++ b/pres2reveal
@@ -38,7 +38,7 @@ foreach($slide as $sld) {
 		}
 	}
 	$slides .= "\t<section";
-	if(!empty($bgcolor)) $slides .= " data-background=\"$bgcolor\"";
+	if(!empty($bgcolor)) $slides .= " data-background-color=\"$bgcolor\"";
 	if(!empty($s['data-transition'])) $slides .= " data-transition=\"{$s['data-transition']}\"";
 	$slides .= ">\n";
 
@@ -58,6 +58,7 @@ foreach($slide as $sld) {
 			case 'notes':
 			case 'literal':
 			case 'example':
+			case 'movie':
 				$fnc ="render_$k";
 				if(is_array($e)) {
 					foreach($e as $ee) {
@@ -196,6 +197,27 @@ function render_example($e) {
 	return $ret;
 }
 
+function render_movie($e) {
+	global $slide_path;
+
+	$width = $height = $poster = '';
+	if(!empty($e['width'])) $width = "width=\"{$e['width']}\" ";
+	if(!empty($e['height'])) $height = "height=\"{$e['height']}\" ";
+	if(!empty($e['poster'])) $poster = "poster=\"{$e['poster']}\" ";
+	$filename = $e['filename'];
+
+	$ret = <<<EOB
+	<div id="container">
+      <video id='video' controls="controls" preload='none'
+        $width $poster>
+        <source id='mp4' src="{$slide_path}/$filename" type='video/mp4'/>
+        <p>Your user agent does not support the HTML5 Video element.</p>
+      </video>
+    </div>
+EOB;
+	return $ret;
+}
+
 function render_notes($e) {
 	$notes = markup_text(nl2br((string)$e));
 	$ret = "<aside class=\"notes\">$notes</aside>\n";