-
Notifications
You must be signed in to change notification settings - Fork 2
Video
Alireza Kamali edited this page Oct 18, 2024
·
1 revision
The Video
class allows you to retrieve detailed information about a video using its unique ID (e.g., vi123456
). It extracts metadata such as the video title, description, type, runtime, and available playback URLs.
This method retrieves video metadata and playback URLs from a specified video ID and fetches the video details and returns structured data as an array.
Parameter | Type | Description | Example |
---|---|---|---|
$id |
string | The unique identifier for the video. | "vi1234567" |
An array containing metadata about the video, including its ID, type, title, description, thumbnail details, runtime, creation date, and available playback URLs. If the $id
is empty or invalid, an empty array will be returned.
The method returns an array with the following structure:
[
'id' => 'vi1234567', // The video ID
'type' => 'Trailer', // Type of the video (e.g., Trailer, Clip)
'title_id' => 'tt1234567', // IMDb title ID associated with the video
'title' => 'Inception', // Primary title of the video
'video_title' => 'Inception Official Trailer', // Title of the video
'description' => 'A mind-bending thriller...', // Description of the video
'caption' => 'Inception Poster', // Caption for the primary image
'thumbnail' => 'https://example.com/thumbnail.jpg', // URL to the thumbnail image
'thumbnail_width' => 1920, // Width of the thumbnail
'thumbnail_height' => 1080, // Height of the thumbnail
'aspect_ratio' => '16:9', // Aspect ratio of the video
'runtime' => '2:30', // Formatted runtime (HH:MM:SS)
'runtime_sec' => 150, // Runtime in seconds
'created_date' => '2023-01-01', // Creation date of the video
'urls' => [ // List of playback URLs
[
'quality' => '1080p', // Quality label (e.g., 1080p, 720p)
'mime_type' => 'video/mp4', // MIME type of the video
'url' => 'https://example.com/video_1080p.mp4' // URL of the video
],
[
'quality' => '720p',
'mime_type' => 'video/mp4',
'url' => 'https://example.com/video_720p.mp4'
]
// ... more URLs
]
]
$video = new Video();
$result = $video->video('vi1234567');
print_r($result);
This will return an array of video metadata:
[
'id' => 'vi1234567',
'type' => 'Trailer',
'title_id' => 'tt1234567',
'title' => 'Inception',
'video_title' => 'Inception Official Trailer',
'description' => 'A mind-bending thriller...',
'caption' => 'Inception Poster',
'thumbnail' => 'https://example.com/thumbnail.jpg',
'thumbnail_width' => 1920,
'thumbnail_height' => 1080,
'aspect_ratio' => '16:9',
'runtime' => '2:30',
'runtime_sec' => 150,
'created_date' => '2023-01-01',
'urls' => [
[
'quality' => '1080p',
'mime_type' => 'video/mp4',
'url' => 'https://example.com/video_1080p.mp4'
],
[
'quality' => '720p',
'mime_type' => 'video/mp4',
'url' => 'https://example.com/video_720p.mp4'
]
]
]