VIMANTRA PHP SDK enables you to easily host and stream your videos using VIMANTRA Cloud Video Platform. The PHP SDK enables you to integrate the platform with your website or application. This presentation is for developers who want to get a quick intro to the PHP SDK.
2. Next 3 Slides may be
skipped if you know
what’s VIMANTRA
3. 95% of Asian Video Streaming
Suffers from
DON’T SUPPORT MOBILE VIDEO, NOT ENOUGH BANDWIDTH, BUGGY VIDEO PLAYERS
4. Problem with WebTV
Infrastructure
Its Expensive
- Global Content Delivery networks have high upfront costs
- Video Transcoding to convert the video for multiple end user devices requires
expensive software and hardware infrastructure
- Costly and lengthy development cycle to build players which work across devices.
- High Capital Costs for video storage.
Technically Complex
- As viewers become mobile across devices, new video encoding formats have to be
handled
- Integration with ad exchanges to monetize your content requires complex
integration
- your player has to be aware of the end users device before it requests an ad
5. VIMANTRA Solves
This Problem
Upload Your
Video to
Vimantra
Vimantra converts for
over 100+ devices and
stores your video.
Integrated with CDN with
presence in 140+ cities
across the world.
Vimantra’s Unique Embed
Codes and API have
automatic device
detection and CDN
integration. Play the right
format from the server
nearest to the viewer.
7. WHERE CAN I GET THE API
www.vimantra.com
Login/API -> Vimantra API
8. WHERE CAN I GET THE API –
DIRECT Links
Documentation
Tar File with PHP SDK
Tar File with PHP SDK and Test
Videos
http://fpc.vimantra.com/corp/VIMANTRA+PHP+S
DK+-+3+Steps+to+Get+You+Started.pdf
http://fpc.vimantra.com/corp/sdkvimantra_php_
1.0_lite.tar
http://fpc.vimantra.com/corp/sdkvimantra
_php_1.0.tar
9. SETUP – Untar and Start
CONFIG FILE
cd sdkvimantra_php_1.0
vi vimantra.config.php
<?php
VIMANTRA KEY
VIMANTRA TOKEN
AWS TOKEN
AWS SECRET
/**
*
*/
// Vimantra access info
if (!defined('vimantraAccessKey'))
define('vimantraAccessKey',’YOUR-ACCESS-KEY’);
if (!defined('vimantraToken'))
define('vimantraToken', 'YOUR-API-TOKEN');
if (!defined('AWSKEY'))
define('AWSKEY', ‘YOUR-AWS-KEY');
if (!defined('AWSSECRET'))
define('AWSSECRET', 'YOUR-AWS-SECRET');
?>
AWS KEY & AWS SECRET are required only if you are uploading
videos from AmazonS3
10. VIMANTRA KEY & TOKEN
You can get your VIMANTRA Key & Token from VIMANTRA
Content Management Console. Its under Settings->My User
Profile.
11. API USE CASE
Upload Video to
Vimantra
Generate Embed
Code
Paste Embed Code on
your website.
It works across devices
globally.
12. VIMANTRA - Instance
All sample code is under subdirectory samples
Instantiate vimantra
…..
if (!class_exists('vimantra'))
require_once '../vimantra.php';
require_once '../vimantra.config.php';
// Instantiate the class
$vim = new vimantra(vimantraAccessKey, vimantraToken);
……
13. UPLOAD - From Desktop
Sample Code File: vimantra.fileupload.php
……
$data = array("displayname" => "SINTEL Trailer desktop video upload",
"file_contents" => '@./sintel480p.mp4',
"actiontype" => "File-Upload");
$vim->fileUpload($data);
$media_upload =
echo "Vimantra::fileUpload(): " . print_r($media_upload) . "n";
….
Upload Video
File from PC
14. UPLOAD - From AmazonS3
If your S3 file has granted read-only access for
everyone then you don’t have to use the AWS KEY &
SECRET
Sample Code File: vimantra.uploads3public.php
……
$data = array(
Upload Video
File from
AmazonS3
- Public
Access
"amazon_bucket" => "mybucket",
"amazon_directory_name" => "video/video2.mp4",
"displayname" => "Public post_" . time(),
"actiontype" => "Upload-S3"
);
$vim->UploadS3($data);
$media_upload =
echo "nVimantra::UploadS3(): " . print_r($media_upload) . "n";
….
16. UNIQUE ID
Typical Result : You get a unique ID for your video
(
[responsetype] => media/postAction/File-Upload
[status] => OK
[session] => Array
(
[0] => Array
(
[account] => mycompany
[ipAddress] => XXX.XXX.XXX.XXX
[location] => Array
(
[countryCode] => XX
[regionCode] => 00
)
Upload Video
File
[message] => File uploaded successfully.
)
)
[Parentmediaid] => 0nApksHymX
)
17. WHERE IS MY VIDEO ?
Sample Code File: vimantra.findmedia.php
…….
$parentid = "0nApksHymX";
$media = $vim->findMedia($parentid);
echo "Vimantra::findMedia(): " . print_r($media) . "n";
…….
Whats
happening to
my video.
18. DIRECT Access Links
VIMANTRA Converts Your Videos for ABR
Result: vimantra.findmedia.php
[contents] => Array
(
[id] => 0nApksHymX
[idtype] => parent
[media] => Array
(
[parentmediaid] => 0nApksHymX
[displayname] => SINTEL Trailer desktop video upload
……..
Whats
happening to
my video.
(
[mediatype] => TRAILER
[displayname] => SINTEL Trailer desktop video upload
……………………………………..)
[Conversions] => Array
(
[tnoc] => 1
[conversion] => Array
(
[0] => Array
(
[conversiontype] => Adaptive Bit Rate
[convertedmediaid] => abr_0nApksHymX
[conversionstatus] => Ready
[convertedon] => 2013-10-04 14:13:42
[hls] =>
http://hmc.vimantra.com/4/0MlorFc0La/abr/abr_0MlorFc0La.m3u8
[hds] =>
http://smc.vimantra.com/4/0MlorFc0La/abr/abr_0MlorFc0La.f4m