PHP Classes

File: test_video_details.php

Recommend this page to a friend!
  Classes of Manuel Lemos   PHP Embed Video   test_video_details.php   Download  
File: test_video_details.php
Role: Example script
Content type: text/plain
Description: Example of getting the video details and display the video embedded in the pages with the embed HTML tags generated by the class
Class: PHP Embed Video
Embed player for other site video or presentation
Author: By
Last change: Added links to the dependent packages.
Date: 0 years ago
Size: 1,713 bytes
 

Contents

Class file image Download
<html>
<head>
<title>test</title>
</head>
<body>
<?php
   
include('embed_video.php');

   
// Get this class from this page:
    // https://www.phpclasses.org/package/4-PHP-Arbitrary-XML-parser-.html
   
include('filecacheclass.php');

   
// Get this class from this page:
    // https://www.phpclasses.org/package/12086-PHP-Get-details-and-manage-videos-using-YouTube-API-v3.html
   
include('xml_parser.php');

   
// Get this class from this page:
    // https://www.phpclasses.org/package/313-PHP-Cache-arbitrary-data-in-files-.html
   
include('youtube_client.php');

   
$url = 'https://www.youtube.com/watch?v=UZe7hcbNlXY';
   
$video = new embed_video_class;
   
$video->width = '560px';
   
$video->height = '315px';
   
$video->lazy_load = true;
   
$video->youtube_key = ''; $application_line = __LINE__;
    if(
$video->youtube_key === '')
    {
        echo
'<h1>You need to set the YouTube API Key in line ', $application_line, '.</h1>', "\n";
        echo
'<p>', 'Please go to ',
           
'<a href="https://console.developers.google.com/project">Google Developer API Console</a>,'.
           
' get a key for the YouTube API'.'
            and set it in the line '
.$application_line, '</p>';
    }
    else
    {
        if(
$video->GetVideoDetails($url, '', $details))
        {
           
$tags = $video->GetVideo(0, true, $details['title'], $url);
            echo
'<h1>Details for video: ', $url, '</h1>', "\n";
            echo
'<pre>';
           
print_r($details);
            echo
'</pre>';
            echo
'<div align="center">'.$tags.'</div>';
            echo
'<div align="center"><pre style="width: 40em; border-style: solid; border-width: 1px; text-align: left; white-space: pre-wrap; word-wrap: break-word;">'.htmlspecialchars($tags), '</pre></div>';
        }
        else
            echo
'<h1>Error: ', HtmlSpecialChars($video->error), '</h1>', "\n";
    }
?>
</body>
</html>