proxitok/app/Controllers/EmbedController.php

22 lines
558 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\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()) {
2022-11-26 17:28:59 -05:00
$item = $video->getFeed()->items[0];
$info = $video->getInfo();
Wrappers::latte('video', new VideoTemplate($item, $info, 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
}
}
}