mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Minor improvements in video attachments
This commit is contained in:
parent
7ed870c3c6
commit
cbec4b549f
3 changed files with 17 additions and 7 deletions
|
@ -14,5 +14,5 @@ abstract class VideoDriver
|
|||
|
||||
abstract function getURL(): string;
|
||||
|
||||
abstract function getEmbed(): string;
|
||||
abstract function getEmbed(string $w = "600", string $h = "340"): string;
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@ final class YouTubeVideoDriver extends VideoDriver
|
|||
return "https://youtu.be/$this->id";
|
||||
}
|
||||
|
||||
function getEmbed(): string
|
||||
function getEmbed(string $w = "600", string $h = "340"): string
|
||||
{
|
||||
return <<<CODE
|
||||
<iframe
|
||||
width="600"
|
||||
height="340"
|
||||
width="$w"
|
||||
height="$h"
|
||||
src="https://www.youtube-nocookie.com/embed/$this->id"
|
||||
frameborder="0"
|
||||
sandbox="allow-same-origin allow-scripts allow-popups"
|
||||
|
|
|
@ -9,9 +9,19 @@
|
|||
</a>
|
||||
{/if}
|
||||
{elseif $attachment instanceof \openvk\Web\Models\Entities\Video}
|
||||
<div class="bsdn media" data-name="{$attachment->getName()}" data-author="{$attachment->getOwner()->getCanonicalName()}">
|
||||
<video class="media" src="{$attachment->getURL()}"></video>
|
||||
</div>
|
||||
{if $attachment->getType() === 0}
|
||||
<div class="bsdn media" data-name="{$attachment->getName()}" data-author="{$attachment->getOwner()->getCanonicalName()}">
|
||||
<video class="media" src="{$attachment->getURL()}"></video>
|
||||
</div>
|
||||
{else}
|
||||
{var $driver = $attachment->getVideoDriver()}
|
||||
{if !$driver}
|
||||
<span style="color:red;">{_version_incompatibility}</span>
|
||||
{else}
|
||||
{$driver->getEmbed("100%")|noescape}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<div class="video-wowzer">
|
||||
<img src="/assets/packages/static/openvk/img/videoico.png" />
|
||||
<a href="/video{$attachment->getPrettyId()}">{$attachment->getName()}</a>
|
||||
|
|
Loading…
Reference in a new issue