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 {
2023-04-27 14:23:23 -04:00
public static function v2(int $id) {
2022-04-10 06:10:48 -04:00
$api = Wrappers::api();
2022-09-03 08:01:03 -04:00
$video = $api->video($id);
$video->feed();
if ($video->ok()) {
2022-11-26 17:51:45 -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
}
}
}