2020-06-07 19:04:43 +03:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
namespace openvk\Web\Models\VideoDrivers;
|
|
|
|
|
|
|
|
final class YouTubeVideoDriver extends VideoDriver
|
|
|
|
{
|
|
|
|
function getThumbnailURL(): string
|
|
|
|
{
|
2022-02-06 16:44:49 +03:00
|
|
|
return "https://img.youtube.com/vi/$this->id/mqdefault.jpg";
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getURL(): string
|
|
|
|
{
|
|
|
|
return "https://youtu.be/$this->id";
|
|
|
|
}
|
|
|
|
|
2023-02-07 23:39:07 +03:00
|
|
|
function getEmbed(string $w = "600", string $h = "340"): string
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
|
|
|
return <<<CODE
|
|
|
|
<iframe
|
2023-02-07 23:39:07 +03:00
|
|
|
width="$w"
|
|
|
|
height="$h"
|
2022-12-09 01:14:15 +03:00
|
|
|
src="https://www.youtube-nocookie.com/embed/$this->id"
|
2020-06-07 19:04:43 +03:00
|
|
|
frameborder="0"
|
|
|
|
sandbox="allow-same-origin allow-scripts allow-popups"
|
|
|
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
|
|
|
allowfullscreen></iframe>
|
|
|
|
CODE;
|
|
|
|
}
|
|
|
|
}
|