mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +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 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";
|
return "https://youtu.be/$this->id";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEmbed(): string
|
function getEmbed(string $w = "600", string $h = "340"): string
|
||||||
{
|
{
|
||||||
return <<<CODE
|
return <<<CODE
|
||||||
<iframe
|
<iframe
|
||||||
width="600"
|
width="$w"
|
||||||
height="340"
|
height="$h"
|
||||||
src="https://www.youtube-nocookie.com/embed/$this->id"
|
src="https://www.youtube-nocookie.com/embed/$this->id"
|
||||||
frameborder="0"
|
frameborder="0"
|
||||||
sandbox="allow-same-origin allow-scripts allow-popups"
|
sandbox="allow-same-origin allow-scripts allow-popups"
|
||||||
|
|
|
@ -9,9 +9,19 @@
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{elseif $attachment instanceof \openvk\Web\Models\Entities\Video}
|
{elseif $attachment instanceof \openvk\Web\Models\Entities\Video}
|
||||||
<div class="bsdn media" data-name="{$attachment->getName()}" data-author="{$attachment->getOwner()->getCanonicalName()}">
|
{if $attachment->getType() === 0}
|
||||||
<video class="media" src="{$attachment->getURL()}"></video>
|
<div class="bsdn media" data-name="{$attachment->getName()}" data-author="{$attachment->getOwner()->getCanonicalName()}">
|
||||||
</div>
|
<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">
|
<div class="video-wowzer">
|
||||||
<img src="/assets/packages/static/openvk/img/videoico.png" />
|
<img src="/assets/packages/static/openvk/img/videoico.png" />
|
||||||
<a href="/video{$attachment->getPrettyId()}">{$attachment->getName()}</a>
|
<a href="/video{$attachment->getPrettyId()}">{$attachment->getName()}</a>
|
||||||
|
|
Loading…
Reference in a new issue