proxitok/app/Controllers/EmbedController.php
2023-04-27 20:23:23 +02:00

22 lines
558 B
PHP

<?php
namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Wrappers;
use App\Models\VideoTemplate;
class EmbedController {
public static function v2(int $id) {
$api = Wrappers::api();
$video = $api->video($id);
$video->feed();
if ($video->ok()) {
$item = $video->getFeed()->items[0];
$info = $video->getInfo();
Wrappers::latte('video', new VideoTemplate($item, $info, true));
} else {
ErrorHandler::showMeta($video->error());
}
}
}