summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-08-04 23:19:21 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-08-04 23:19:21 +0200
commit2bc6b97401791ae4ced15b7e8f903efd6e76e09f (patch)
tree3b793ac21e3c5e284288f25d2d1ec5e3abb6f735
parent2345c4c840a4571b9cbb0a021b4c49f9381875ce (diff)
Add audio and video players to multipastes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/controllers/file.php5
-rw-r--r--application/views/file/fragments/audio-player.php8
-rw-r--r--application/views/file/fragments/video-player.php12
-rw-r--r--public_html/data/css/style.css4
4 files changed, 28 insertions, 1 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 35057f4eb..571a4272f 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -203,7 +203,6 @@ class File extends MY_Controller {
$mimetype = $filedata["mimetype"];
$base = explode("/", $filedata["mimetype"])[0];
- // TODO: handle video/audio
if (\libraries\Image::type_supported($mimetype)) {
$filedata["tooltip"] = $this->_tooltip_for_image($filedata);
$filedata["orientation"] = libraries\Image::get_exif_orientation($file);
@@ -211,6 +210,10 @@ class File extends MY_Controller {
array("items" => array($filedata)),
'file/fragments/thumbnail'
);
+ } else if ($base == "audio") {
+ $this->output_cache->add(array("filedata" => $filedata), "file/fragments/audio-player");
+ } else if ($base == "video") {
+ $this->output_cache->add(array("filedata" => $filedata), "file/fragments/video-player");
} else {
$this->output_cache->add_merge(
array("items" => array($filedata)),
diff --git a/application/views/file/fragments/audio-player.php b/application/views/file/fragments/audio-player.php
new file mode 100644
index 000000000..517506039
--- /dev/null
+++ b/application/views/file/fragments/audio-player.php
@@ -0,0 +1,8 @@
+<div class="container-wide">
+<p>
+ <audio controls="controls">
+ <source src="<?php echo site_url($filedata["id"]); ?>">
+ </audio>
+ <?php echo anchor(site_url($filedata['id']), htmlspecialchars($filedata["filename"])); ?>
+</p>
+</div>
diff --git a/application/views/file/fragments/video-player.php b/application/views/file/fragments/video-player.php
new file mode 100644
index 000000000..096bb2d59
--- /dev/null
+++ b/application/views/file/fragments/video-player.php
@@ -0,0 +1,12 @@
+<div class="container-wide">
+<div class='panel panel-default'>
+ <div class='panel-heading'>
+ <?php echo anchor(site_url($filedata['id']), htmlspecialchars($filedata["filename"])); ?>
+ </div>
+ <div>
+ <video controls="controls">
+ <source src="<?php echo site_url($filedata["id"]); ?>">
+ </video>
+ </div>
+</div>
+</div>
diff --git a/public_html/data/css/style.css b/public_html/data/css/style.css
index f59344f6f..06ab6bcd1 100644
--- a/public_html/data/css/style.css
+++ b/public_html/data/css/style.css
@@ -330,6 +330,10 @@ input[type="number"]::-webkit-inner-spin-button {
}
input[type="number"] { -moz-appearance: textfield; }
+video {
+ max-width: 100%;
+}
+
/* highlighting theme */
.hll { background-color: #ffffcc }
.c { color: #999988; font-style: italic } /* Comment */