mirror of
https://github.com/sigmasternchen/MyTube
synced 2025-03-15 04:48:55 +00:00
fixed problems with dashboard video size;
added placeholder image for thumbnail
This commit is contained in:
parent
51edc12d01
commit
97df61e261
7 changed files with 44 additions and 12 deletions
BIN
gimp/no-video.xcf
Normal file
BIN
gimp/no-video.xcf
Normal file
Binary file not shown.
BIN
gimp/user.xcf
Normal file
BIN
gimp/user.xcf
Normal file
Binary file not shown.
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
.video-tile {
|
.video-tile {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 3%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-tile:after {
|
.video-tile:after {
|
||||||
|
@ -19,7 +18,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.tile-content {
|
.tile-content {
|
||||||
position: relative;
|
position: absolute;
|
||||||
|
left: 8.5%;
|
||||||
|
top: 8.5%;
|
||||||
|
height: 83%;
|
||||||
|
width: 83%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
|
|
BIN
public/images/no-video.png
Normal file
BIN
public/images/no-video.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
|
@ -26,6 +26,7 @@ class WatchController extends AbstractController
|
||||||
public const OWNER_LINK_ID = "owner";
|
public const OWNER_LINK_ID = "owner";
|
||||||
public const CONTENT_RELATIVE = "../";
|
public const CONTENT_RELATIVE = "../";
|
||||||
public const CONTENT_DIRECTORY = "content/videos/";
|
public const CONTENT_DIRECTORY = "content/videos/";
|
||||||
|
public const PUBLIC_DIRECTORY = "public/";
|
||||||
|
|
||||||
private const PLAYLIST_MIME_TYPE = "application/x-mpegURL";
|
private const PLAYLIST_MIME_TYPE = "application/x-mpegURL";
|
||||||
private const TS_FILE_MIME_TYPE = "video/MP2T";
|
private const TS_FILE_MIME_TYPE = "video/MP2T";
|
||||||
|
@ -158,7 +159,11 @@ class WatchController extends AbstractController
|
||||||
{
|
{
|
||||||
$data = $this->checkRequestData($videoId, $linkId);
|
$data = $this->checkRequestData($videoId, $linkId);
|
||||||
|
|
||||||
$file = self::CONTENT_RELATIVE . self::CONTENT_DIRECTORY . $data["video"]->getId() . "/" . "thumb.png";
|
if ($data["video"]->getState() > Video::PROCESSING_THUMBNAIL) {
|
||||||
|
$file = self::CONTENT_RELATIVE . self::CONTENT_DIRECTORY . $data["video"]->getId() . "/" . "thumb.png";
|
||||||
|
} else {
|
||||||
|
$file = self::CONTENT_RELATIVE . self::PUBLIC_DIRECTORY . "images/no-video.png";
|
||||||
|
}
|
||||||
|
|
||||||
$response = new BinaryFileResponse($file);
|
$response = new BinaryFileResponse($file);
|
||||||
$response->headers->set("Content-Type", self::THUMBNAIL_MIME_TYPE);
|
$response->headers->set("Content-Type", self::THUMBNAIL_MIME_TYPE);
|
||||||
|
|
|
@ -225,6 +225,31 @@ class Video
|
||||||
return $this->length;
|
return $this->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFormatedLength(): string
|
||||||
|
{
|
||||||
|
if (!$this->length) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
$length = $this->length;
|
||||||
|
$result = "";
|
||||||
|
|
||||||
|
while ($length > 0) {
|
||||||
|
$currentPosition = $length % 60;
|
||||||
|
$length = intval($length / 60);
|
||||||
|
|
||||||
|
$result = sprintf("%02d:", $currentPosition) . $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = substr($result, 0, strlen($result) - 1);
|
||||||
|
|
||||||
|
if (strlen($result) == 2) {
|
||||||
|
$result = "00:" . $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function setLength(?float $length): self
|
public function setLength(?float $length): self
|
||||||
{
|
{
|
||||||
$this->length = $length;
|
$this->length = $length;
|
||||||
|
|
|
@ -19,12 +19,9 @@
|
||||||
element.getElementsByClassName("disable")[0].remove();
|
element.getElementsByClassName("disable")[0].remove();
|
||||||
clearInterval(intervalIds[id]);
|
clearInterval(intervalIds[id]);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (data.stateId > {{ constant("App\\Entity\\Video::PROCESSING_THUMBNAIL") }}) {
|
if (data.stateId > {{ constant("App\\Entity\\Video::PROCESSING_THUMBNAIL") }}) {
|
||||||
let image = element.getElementsByClassName("thumbnail")[0].getElementsByTagName("img")[0];
|
let image = element.getElementsByClassName("thumbnail")[0].getElementsByTagName("img")[0];
|
||||||
if (image.hasAttribute("data-src")) {
|
image.src = image.src + "?refresh";
|
||||||
image.src = image.getAttribute("data-src");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
element.getElementsByClassName("state")[0].innerText = data.state;
|
element.getElementsByClassName("state")[0].innerText = data.state;
|
||||||
|
@ -58,11 +55,10 @@
|
||||||
videoId: video.customId
|
videoId: video.customId
|
||||||
}) }}'">
|
}) }}'">
|
||||||
<img alt="Thumbnail"
|
<img alt="Thumbnail"
|
||||||
{{ video.state > constant("App\\Entity\\Video::PROCESSING_THUMBNAIL") ? "src" : "data-src" }}
|
src="{{ path("app_watch_thumbnail", {
|
||||||
="{{ path("app_watch_thumbnail", {
|
linkId: constant("App\\Controller\\WatchController::OWNER_LINK_ID"),
|
||||||
linkId: constant("App\\Controller\\WatchController::OWNER_LINK_ID"),
|
videoId: video.customId
|
||||||
videoId: video.customId
|
}) }}"/>
|
||||||
}) }}"/>
|
|
||||||
<div class="play-button">
|
<div class="play-button">
|
||||||
<i class="fas fa-play"></i>
|
<i class="fas fa-play"></i>
|
||||||
</div>
|
</div>
|
||||||
|
@ -77,6 +73,9 @@
|
||||||
<div class="views">
|
<div class="views">
|
||||||
{{ video.views }} {{ video.views == 1 ? "View" : "Views" }}
|
{{ video.views }} {{ video.views == 1 ? "View" : "Views" }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="length">
|
||||||
|
{{ video.getFormatedLength() }}
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
{{ video.description }}
|
{{ video.description }}
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue