You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VOD SDK is a client package to connect to Arvan VOD API to make your life much easier :)
This package has written in pure php which can be implemented in any PHP framework.
For more details please kindly take a look at the API Doc
The Package has too registered
class AppServiceProvider extends ServiceProvider
{
/** * Bootstrap any application services. */publicfunctionboot()
{
}
/** * Register any application services. */publicfunctionregister()
{
$this->app->bind('arvan-vod-sdk', function ($app) {
return VodSdk::setToken('Apikey xxxxxxxxxxxx');
});
}
}
// SomeController.php$vodSdk = app('arvan-vod-sdk');
UserDomain:
**
* UserDomain:
* There are only two end points for userDomains (create and show).
* please be informed that, create action is only available for just one time and if a user wants to change
* their userDomain, they need to cantact to Arvan support.
*/
// POST$userDomain = $vodkSdk->userDomain();
$createdDomain = $userDomain->createDomain(['subdomain' => 'whatever']);
// GET$getUserDomain = $userDomain->getDomain();
Channel:
**
* in order to create a channel create method is available which accepts and array as the sample in below
*/
// Post$channel = $vodSdk->channel();
$newChannel = $channel-> create([
'title' => 'string',
'description' => 'string',
'secure_link_enabled' => false,
'secure_link_key' => 'string',
'secure_link_with_ip' => true,
'ads_enabled' => false,
'present_type' => 'auto',
'campaign_id' => 'string'
]);
// GET (all channels)$allChannels = $channel->showAll();
// GET (get specific channhel by id)$channelDetails = $channel->show('********-****-****-****-********')
// PATCH (update a channel)$updatedChannel = $channel->update('5c6b18de-9763-423f-8d3e-f2e84e93c9d5', [
'title' => 'whatever from sdk'
]);
// DELETE (delete a channel) $channel->update('********-****-****-****-********');
File:
// GET (get the whole channel files)$channelId = 'xxxx-xxxx-xxxx-xxxx';
$file = $vodSdk->file();
$allChannelFiles = $file->showAll($channelId) // channel ID must be set as a string$music = storage_path('music.mp3');
$storageUrl = $file->createStorage($channelId, $music);
**
* response will be file id andURL, URL can be used to get file offset
* in order to findout whether the file is completely uploaded or not.
*/
$uploadedFile = $file->upload($storageUrl);
// HEAD (Uploaded file url is required)$fileOffset = $file->getOffset('https://napi.arvancloud.com/**************');
// DELETE (by file ID)$file->delete('********-****-****-****-********');
Video / Audio:
$channelId = 'xxxx-xxxx-xxxx-xxxx';
$fileId = 'xxxx-xxxx-xxxx-xxxx';
$video = $file->video();
// GET (get the whole channel videos)$allChannelVideos = $video->showAll($channelId);
// GET (get specific video by ID)$getVideo = $video->showAll('********-****-****-****-********'); //VideoId// POST (convert an uploaded file / upload with an address (URL)$newVideo = $video->create([
[
'title' => 'string',
'description' => 'string',
'video_url' => 'string', // should be null or removed if file_id is exist 'file_id' => 'string',
'convert_mode' => 'auto/manual/profile',
'profile_id' => 'string',
'parallel_convert' => false,
'thumbnail_time' => 0,
'watermark_id' => 'string',
'watermark_area' => 'CENTER', // required if watermark_id is set'convert_info' => [ // required if convert_mode is manual
[
'audio_bitrate' => 0,
'video_bitrate' => 0,
'resolution' => 'string'
],
[
'audio_bitrate' => 0,
'video_bitrate' => 0,
'resolution' => 'string'
],
[
'audio_bitrate' => 0,
'video_bitrate' => 0,
'resolution' => 'string'
]
]
]
]);
// PATCH (update video or audio. Only title and description are editable)$updatedVideo = $video->update('video_id', [
'title' => 'whatever',
'description' => 'something...'
]);
// DELETE (by video / audio ID)$video->delete('********-****-****-****-********');
Watermark:
// GET (get all channel watermarks)$channelId = 'xxxx-xxxx-xxxx-xxxx';
$watermark = $vodSdk->watermark();
$allChannelWarermark = $watermark->showAll($channelId) // channel ID must be set as a string// GET (get specific watermkark)$getWatermark = $watermark->showAll('********-****-****-****-********'); //WatermarkId// Post$newWatermark = $watermark->create([
'title' => 'test',
'description' => 'dasdas',
'watermark' => storage_path('1.jpg')
], 'channel_id');
// PATCH$updatedWatermark = $watermark->update([
'title' => 'new Name',
'description' => 'updated description'
]);
// DELETE (by watermark ID)$watermark->delete('********-****-****-****-********'); //WatermarkId
Subtitle:
$subtitle = $vodSdk->subtitle();
// GET (get all video subtitles)$videoSubtitles = $subtitle->showAll('********-****-****-****-********'); //VideoId// GET (get specific subtitle)$subtitle = $subtitle->show('********-****-****-****-********'); //SubtitleId// POST (create a subtitle)$newSubtitle = $subtitle->create([
'lang' => 'en',
'subtitle' => storage_path('test.vtt')
], '********-****-****-****-********'); //VideoId// DELETE$subtitle->delete('********-****-****-****-********'); //SubtitleId