proxitok/app/Controllers/EmbedController.php

23 lines
615 B
PHP
Raw Normal View History

2022-04-10 06:10:48 -04:00
<?php
namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Helpers\Wrappers;
use App\Models\VideoTemplate;
class EmbedController {
static public function v2(int $id) {
$api = Wrappers::api();
2022-09-03 08:01:03 -04:00
$video = $api->video($id);
$video->feed();
if ($video->ok()) {
$data = $video->getFull();
2022-04-10 06:10:48 -04:00
$latte = Wrappers::latte();
2022-09-03 08:01:03 -04:00
$latte->render(Misc::getView('video'), new VideoTemplate($data->feed->items[0], $data->info->detail, true));
2022-04-10 06:10:48 -04:00
} else {
2022-09-03 08:01:03 -04:00
ErrorHandler::showMeta($video->error());
2022-04-10 06:10:48 -04:00
}
}
}