This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVideo.php
92 lines (83 loc) · 2.61 KB
/
Video.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* Active video details along with it's relevant metadata.
*
*/
require_once 'User.php';
class Video
{
var $version;
var $id;
var $title;
var $description;
var $createdAt;
var $url;
var $thumbnail;
var $playCount;
var $duration;
var $width;
var $height;
var $framegrabUrl;
var $user;
static function fromJson($data)
{
$jo = json_decode($data);
$video = new Video();
$video->duration = $jo->duration;
$video->playCount = $jo->play_count;
$video->title = $jo->title;
$video->url = $jo->url;
$video->createdAt = $jo->created_at;
$video->version = $jo->version;
$video->user = new User();
$video->user->authorAccount = $jo->user->author_account;
$video->user->authorName = $jo->user->author_name;
$video->user->authorUrl = $jo->user->author_url;
$video->user->videoCount = $jo->user->video_count;
$video->id = $jo->id;
$video->thumbnail = $jo->thumbnail;
$video->width = $jo->width;
$video->height = $jo->height;
$video->framegrabUrl = 'http://vzaar.com/videos/' . $jo->id . '.frame';
return $video;
}
/**
* Package protected constructor.
*
* @param version the vzaar API version number
* @param id the video ID number
* @param title the video title. It may be null
* @param description the video description. It may be null
* @param createdAt the date time the video was uploaded
* @param url the link to the video page
* @param thumbnailUrl the URL link that points to the video thumbnail
* @param playCount the number of times the video has been played
* @param authorName the vzaar user name (i.e. their login)
* @param authorUrl the link to the vzaar user summary page
* @param authorAccount the number representing the users vzaar account
* @param videoCount the number of active videos in the users account
* @param duration the duration of the video
* @param <integer> width the width of the video
* @param height the height of the video
*/
public function __construct1($version, $id, $title, $description, $createdAt, $url, $thumbnailUrl, $playCount, $authorName, $authorUrl, $authorAccount, $videoCount, $duration, $width, $height)
{
$this->user = new User();
$this->version = $version;
$this->id = $id;
$this->title = $title;
$this->description = $description;
$this->createdAt = $createdAt;
$this->url = $url;
$this->thumbnailUrl = $thumbnailUrl;
$this->playCount = $playCount;
$this->user->authorName = $authorName;
$this->user->authorUrl = $authorUrl;
$this->user->authorAccount = $authorAccount;
$this->user->videoCount = $videoCount;
$this->duration = $duration;
$this->width = $width;
$this->height = $height;
}
}
?>