-
Notifications
You must be signed in to change notification settings - Fork 18
Class: Videos
Videos class is responsible for all major video related operations. This includes uploading, inserting, updating, deleting among many others. This page lists all available methods of Videos class along with examples.
- initialize
- column
- owns
- exists
- idExists
- keyExists
- filenameExists
- get
- getField
- getFields
- setField
- setFieldBulk
- setFields
- setFieldsBulk
- getById
- getByKey
- getByFilename
- getId
- getKey
- getFilename
- getUploaderId
- getUploaderName
- getDate
- getTitle
- getDescription
- getScope
- getFeatured
- getStatus
- getQualities
- getDuration
- getThumbnailsCount
- getViews
- getComments
- getState
- list
- listTrending
- listFresh
- listByState
- listActive
- listInactive
- listByStatus
- listSuccessful
- listPending
- listFailed
- listByScope
- listPublic
- listPrivate
- listUnlist
- listByUploader
- count
- countActive
- parameters
- countInactive
- countSuccessful
- countPending
- countFailed
- validateUpload
- validateUpdate
- validateInsert
- validatePermissions
- activate
- bulkActivate
- deactivate
- bulkDeactivate
- feature
- unfeature
- delete
- bulkDelete
- createKey
- createFilename
- upload
- insert
- update
- setViews
- setComments
Thus method creates required variables and makes things ready for all other parameters. This is a required method when creating new Videos() object.
You can pass already initialized Database object or functional will automatically try to use global object.
$videos = new Videos();
$videos->intialize();
This method determines if given value is video id (int) or vkey (string)
Any videoid or vkey
Returns 'id' or 'vkey' depending on value provided.
$videos->column(1412); // outputs id
$videos->column('7v0cw_tPRm'); // outputs vkey
Check if a video is owned by certain user.
Username to check ownership against.
Videoid or vkey for video to be checked for ownership.
This returns boolean value. Please note that all Admin (user with level 1) own all videos and this will return true if user is Admin even if uploader is different.
$videos->owns('stark', 1412);
$videos->owns('jon', '7v0cw_tPRm');
Check if a value exists against given columns
Single field or set of field => value to match
Value to match against when $fields is string
Fields to return if match is found
Returns boolean or array of fields requested in $fetch parameter
// check if a filename exists
$this->exists('filename', 'GLXiXBPxyxhkelD');
// check if a vkey exists
$this->exists('vkey', '5CGun_cSKF');
// check if vkey, filename and uploader exist for same video and also return fields
$match = array(
'vkey' => '5CGun_cSKF',
'filename' => 'GLXiXBPxyxhkelD',
'uploader_name' => 'ivar_the_boneless'
);
$fields = array('id', 'title', 'duration', 'views');
$this->exists($match, false, $fields);
Check if given id exists
ID to check for
Boolean depending case of value found
$videos->idExists(123);
Check if given vkey exists
vkey to check for
Boolean depending case of value found
$videos->keyExists('143DKSA_DSDA');
Check if given filename exists
Filename to check for
Boolean depending case of value found
$videos->filenameExists('214wdsaDs');
Get all fields for a single video
Value of field to search against
Name of field to search against, by default it tries to determine between ID and vkey
An array of data consisting of all available columns against matching video.
Get a single field for a single video
ID or vkey to search for
Name of field to fetch
An array of data for matching video
Get a multiple fields for a single video
ID or vkey to search for
A list of fields to fetch
An array of data consisting of fields requested only.
Update a single field of single video
Field to be updated
New value to set
Value to search video by
Column to search against. If false then function will consider it vkey.
Boolean depending on how update query went.
Update a single field of multiple videos
Field to be updated
New value to set
Value list to search video by
Column to search against. If false then function will consider it vkey.
Boolean depending on how update query went.
update multiple fields of single video
An assoc. array of field => value to update
Value to search video by
Column to search values against. If false then function will consider it vkey.
Boolean depending on status of update.
update multiple columns of multiple videos
An assoc. array of field => value to update
List of values to search videos by
Column to search values against. If false then function will consider it vkey.
Boolean depending on status of update.
Get all fields of video by id
ID to search video by
An array consisting of all columns for matching video.
Get all fields of video by key
vkey to search video by
An array consisting of all columns for matching video.
Get all fields of video by filename
Filename to search video by
An array consisting of all columns for matching video.
Get ID of video
vkey of video to fetch
ID for matching video
Get key of video
ID of video to fetch
vkey for matching video
Get Filename of video
ID or vkey of video to fetch
Filename for matching video
Get video uploader's ID
ID or vkey of video to fetch
Video uploader's ID for matching video
Get video uploader's name
ID or vkey of video to fetch
Video uploader's name for matching video
Get publish date of video
ID or vkey of video to fetch
The publish date for matching video
Get title of video
ID or vkey of video to fetch
The title for matching video
Get description of video
ID or vkey of video to fetch
Description for matching video
Get scope of video
ID or vkey of video to fetch
Scope for matching video
Get featured status of video
ID or vkey of video to fetch
Featured status for matching video
Get processing status of video
ID or vkey of video to fetch
Processing status for matching video
Get qualities of video
ID or vkey of video to fetch
List of available qualities for matching video
Get duration of video
ID or vkey of video to fetch
Duration for matching video
Get thumbnails count of video
ID or vkey of video to fetch
Total thumbnails count for matching video
Get total views of video
ID or vkey of video to fetch
Total views count for matching video
Get total comments of video
ID or vkey of video to fetch
Total comments count for matching video
Get state of video
ID or vkey of video to fetch
State for matching video
List videos matching several dynamic parameters
An array of parameters to match videos against. This array can contain any of columns from 'videos' table. You can select values using =, >, >=, < or <= to have more control.
An array consisting of videos that matched pattern after $limit was applied.
// list videos by specific uploader
$parameters['uploader_name'] = 'limbs';
$videos->list($parameters);
// list videos longer than 60 seconds
$parameters['duration'] = array('60', '>');
$videos->list($parameters);
// most recent videos by limit
$params['limit'] = 10;
$response = $videos->list($params);
// most viewed videos
$params = array('sort' => 'views');
$response = $videos->list($params);
// get videos longer than 60 seconds by jon_snow with more than 100 views
$params = array(
'uploader_name' => 'jon_snow',
'duration' => array('60', '<')
'views' => array('200', '>')
);
$response = $videos->list($params);
List most viewed videos since start
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List most recent videos
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List most videos by specific state
State of video to fetch. Options for this are active, inactive or disabled
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List videos by active state
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List videos by inactive state
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List videos by processing status
Conversion status of video to fetch. Options for this are pending, successful or failed.
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List successfully processed videos
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List videos that are pending processing
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List most videos that failed during processing
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List by a specific scope
Conversion status of video to fetch. Options for this are pending, successful or failed.
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List public videos
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List private videos
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List unlisted videos
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
List videos by specific uploader
Uploader's name or user ID
Number or MySQL style limit
Additional parameters to apply
An array of videos matching parameters.
Count total videos matching parameters
An array of parameters to match and count videos against
The number of videos found
Count total active videos
An array of parameters to match and count videos against
The number of videos found
Count total inactive videos
An array of parameters to match and count videos against
The number of videos found
Count total successful videos
An array of parameters to match and count videos against
The number of videos found
Count total pending videos
An array of parameters to match and count videos against
The number of videos found
Count total failed videos
An array of parameters to match and count videos against
The number of videos found
Validate video upload data before moving into processing queue
The raw $_FILES object
True if upload is valid and false if it isn't
Validate fields before updating video
The fields array to be updated
True if update is valid and false if it isn't
Validate form before inserting video
The fields array to be updated
True if update is valid and false if it isn't
Validate permissions of logged in user requesting changes to video
ID or vkey of video to check
Boolean
Set video state to active
ID or vkey of video to activate
Boolean depending on how request went
Set video state to active for multiple videos
A list of videos to be activated
Column to match list against. If nothing is specified then it is considered 'vkey'.
Boolean depending on how request went
Set video state to inactive
ID or vkey of video to deactivate
Boolean depending on how request went
Set video state to inactive for multiple videos
A list of videos to be deactivated
Column to match list against. If nothing is specified then it is considered 'vkey'.
Boolean depending on how request went
Set video to featured
ID or vkey of video to be featured
Boolean depending on how request went
Remove video from featured
ID or vkey of video to be unfeatured
Boolean depending on how request went
Delete a video and all media files belonging to it
ID or vkey of video to delete
Boolean depending on how request went
Delete multiple videos and their media files
Set video state to inactive
A list of vkeys to be deleted
Boolean depending on how request went
Create unique public key to be used for new video
Unique video key that doesn't exist in database
Create unique filename to be used for new video
Unique video filename that doesn't exist in database
Upload a new video file
The raw $_FILES object
filename, path and directory of uploaded video
Insert a video into database
Raw form fields
ID of inserted video
Update a video's fields
ID or public key
Array with fields and values to be updated
Boolean depending on how update went
Increment video views
ID or public key
Number of views to increment
Boolean
Increment video comments
ID or public key
Number of comments to increment
Boolean