MistServer PHP API for Live Stream


Hits: 3516  

MistServer is a highly versatile, lightweight, customizable open-source multi-standard multimedia server. MistServer configuration is easy to use for full CDN solutions applications. Hope you already read our article to Install MistServer

Mistserver Manager Login

MistServer API provides a Server API and a Management API.

You can find MistServer PHP API Examples Here

Note: Make sure port 4242 used for MistServer is open on your web hosting firewall where you run MistServer PHP API for Live Stream

MistServer PHP API for Live Stream will try to put/get data using PHP CURL in port 4242

$server = new Mistserver();
$server->login(‘http://server-ip:4242/api’, ‘username’, ‘password’);

// you can add a live stream:
$server->add_stream( STREAM_NAME, push://@SOURCE, BUFFER_TIME);

mistserver-api-form

Your channel has been successfully created. Use the details below to broadcast:
Download: Download Flash Media Live Encoder 3.2
FMS URL: rtmp://server-ip:1935/live
Stream Name: churchstream

mistserver-stream

As you get Live Media Stream details you can use our article to make your event live…
Live video stream event for online Temple or Church

API Call Reference: http://www.mistserver.org/doxygen/api.html

Radio Song Album Artwork Cover by YouTube


Hits: 3377  

An album cover is the front / other side of the packaging of a commercially released audio recording product, or album.

You can find online APIs or Websites where artwork available

– Amazon
– LastFM
– Soundcloud
– Apple iTune
– Google Play
– Gracenote
– Free Music Archive

And many more ….

But YouTube is the best source where you can get Album / Song Cover Image for every Title

YouTube provide gdata API to search songs as video title to get image

Deprecated Features for YouTube API v2.0

YouTube Data API (v3)

http://gdata.youtube.com/feeds/base/videos?q=title:<search term>

youtube-artwork.php

<?php
$q = isset($_REQUEST['q'])?$_REQUEST['q']:"";

//thumbnail -> sqDefault, hqDefault

// orderby -> title, relevance, published

?>
 
 
<div id="videos"></div>
 
<!-- Include the latest jQuery library -->
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
 
<script type="text/javascript">

jQuery.getJSON('https://gdata.youtube.com/feeds/api/videos?q=<?php echo $q; ?>&max-results=1&v=2&alt=jsonc&orderby=relevance', function(data) {
    var output="<ul>";
    for (var i in data.data.items) {
        
		output+="<li><img src='" + data.data.items[i].thumbnail.hqDefault + "' /></li>";
		output+="<li>" + data.data.items[i].title + "</li>";
		
    }
	var output="</ul>";
	
    document.getElementById("videos").innerHTML=output;
	
	});

</script>

How you can get cover image?

http://www.domain.com/youtube-artwork.php?q=Ek%20Villain%20-%20Galliyan

song album artwork

PayPal auto redirect credit card user to website after payment


Hits: 3953  

I have a problem on my Pay Per Video Website (PPV), Guests normally watch preview of videos for few seconds then PayPal Screen appear to watch full version of video content.

payperview-app-payment-screen

Pay Per Plugin for HTML5 Media – Pay Per Plugin for HTML5 Media Plugin is embedded stand-alone, e-commerce-powered JavaScript and iFramed widget for Audio/Video. – See more at: http://html5plus.svnlabs.com/shop/pay-per-plugin-for-html5-media/#.UsuLItIW2So

I am using paypal form …

<form action=”<?php echo $paypal_link; ?>” target=”_top” method=”post” name=”payPalForm”>
<input type=”hidden” name=”business” value=”<?php echo $business_email;?>”>
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”item_name” value=”<?php echo $item_name; ?>”>
<input type=”hidden” name=”item_number” value=”<?php echo $item_number; ?>”>
<input type=”hidden” name=”amount” value=”<?php echo sprintf(“%01.2f”, $amount); ?>”>
<input type=”hidden” name=”no_shipping” value=”1″>
<input type=”hidden” name=”currency_code” value=”<?php echo $currency_code; ?>”>
<input type=”hidden” name=”handling” value=”0″>
<input type=”hidden” name=”rm” value=”2″ >
<input type=”hidden” name=”cancel_return” value=”<?php echo $siteurl; ?>cancel.php”>
<input type=”hidden” name=”return” value=”<?php echo $siteurl; ?>success.php”>
<input type=”image” src=”https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif” border=”0″ name=”submit” alt=”PayPal – The safer, easier way to pay online!”>
<img alt=”” border=”0″ src=”https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″>
</form>

 

I have enabled auto return ON and auto return URL in paypal settings already ….

Auto Return URL

When customers pay using paypal they easily redirected to PPV website … but if someone (guest) pay from credit card .. they have to click on link to redirect back to website …. 🙁

PayPal Auto Redirect to Website

Solution:

You can find more info here Merchant Services from PayPal – Payment Solutions for Your Business

PayPal Standard Payments is designed in such a way if a customer pays as guest (they don’t have a PayPal Account), after they complete the checkout process, PayPal will offer to open PayPal Account or click on the link to return them to PPV website. Customers “must” click on the link in order to return to your web site.

You can use either PayPal Payments Pro or Advanced, if you want the customer to remain on your web site for the checkout process. Advanced PayPal method enable customer to remains on PPV website. The PayPal process work thru a window or frame on your website.

Merchant Services from PayPal - Payment Solutions for Your Business

PayPal Pro and Advanced are available in additional monthly costs as well as the transaction processing fees.
Pro is $30 a month, Advanced is $5 a month. 🙂

Kaltura Red5 iOS Live Streams Setup


Hits: 7352  

We have a plugin that can be used for streaming kaltura live red5 rtmp to mobile devices.

Kaltura Red5 Live Plugin take below data to segment live video stream

– Red5 Live Video RTMP Stream Link
– Red5 Stream Name
– Publishing Folder
– Publishing Link

Configure Live Stream for Mobile on Kaltura Red5
Configure Live Stream for Mobile on Kaltura Red5

The Main feature of this plugin to show live RTMP streams using Adobe FMLE, on computers using the Kaltura Player and HTML5 player on mobile devices using M3U8 video iOS compatible format.

– Capture Red5 live kaltura stream for FFMpeg Segmentation
– Manage Segmented Clips in M3U8 format
– Stream iOS compatible video to iPhone / iPad in HTML5 Player
– Track Analytic / Stats for live stream in HTML5 Player
– Embed code for HTML5 Player
– Track process log

Live Stream for Mobile on Kaltura Red5
Live Stream for Mobile on Kaltura Red5
KMC - content - manage
KMC – content – manage

Process Log Live Stream for Mobile on Kaltura Red5

Process Log Live Stream for Mobile on Kaltura Red5
Process Log Live Stream for Mobile on Kaltura Red5

Embed Code Live Stream for Mobile on Kaltura Red5

Embed Live Stream for Mobile on Kaltura Red5
Embed Live Stream for Mobile on Kaltura Red5

Related Articles
* VOD to iOS
* Record Audio from Websites
* Red5 Media Server iOS Android Setup

Kaltura Live Red5 CAM RTMP to iOS (iPhone or iPad). Get more help for HTTP Live Video Stream Segmenter and Distributor Contact Us

RTMP (Red5) -> FFMpeg -> Segementer -> .ts files -> iOS (m3u8)

Install Apache, PHP, MySQL on HP Cloud


Hits: 5481  

I am playing with all cloud services these days, so today we will try to setup Apache, PHP, MySQL on HP Cloud. HP Cloud is based on OpenStack Compute

Hope you already read our old article “Installing Apache, MySQL, PHP in CentOS 5.5 on Rackspace Cloud”?

In the HP Cloud Console Area you can manage

– Servers / Storage
– Floating IPs
– Images
– Key Pairs
– Security Groups
– Volumes

First you need to create Key Pairs and some rule in security default group…

Security Group Rules
Security Group Rules

HP Cloud Compute Overview

HP Cloud Object Storage Overview

You can start any type of server CentOS, Ubuntu using HP Cloud GUI …

Server on HP Cloud
Server on HP Cloud

Also you can manage running instances easily…

Manager Server on HP Cloud
Manager Server on HP Cloud

You can connect to server using SSH on port 22

# ssh -i KEYPair.pem root@IP-Address

In windows.. create PPK file from PEM Keypair using PuTTYgen

Install Apache

# sudo yum install httpd mod_ssl

Install MySQL

# yum install mysql mysql-server
# /etc/init.d/mysqld start

Install PHP

# yum install php php-common php-gd php-mcrypt php-pear php-pecl-memcache php-mhash php-mysql php-xml php-mbstring

# /etc/init.d/httpd start

You can access HP Cloud using HP Cloud Services APIs and HP Cloud Services CLI

Facebook Adding an App to a Page


Hits: 6303  

You can provide App to Fan Page Tab using URL, but you must check below options to get App (Page Tab) Added Page ID?

https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL

After successful authorization users will redirect to your Site URL with pageID

http://www.domain.com/?tabs_added[pageID]=1#_=_

App Page Tab Settings
App Page Tab Settings
Add Page Tab Dialog
Add Page Tab Dialog

Integrating with Facebook APIs

When a user selects Page Tab and authorize your application, you receive the signed_request parameter with one additional parameter, page.

JSON object
id (the page id of the current page)
admin (if the user is a admin of the page)
liked (if the user has liked the page).

Option 1: Canvas Page
$signedRequest = $facebook->getSignedRequest();

Option 2: App Domain / Site URL
if(array_key_exists(‘tabs_added’, $_REQUEST)) {
$id = array_keys($_REQUEST[‘tabs_added’]);
$pageId = $id[0];
echo $pageId;
}

Option 3: Page Tab URL
if (!empty($_REQUEST[‘signed_request’])) {
list($encodedSig, $payload) = explode(‘.’, $_REQUEST[‘signed_request’], 2);
$requestData = json_decode(base64_decode(strtr($payload, ‘-_’, ‘+/’)), true);
if (!empty($requestData[‘page’]) && isset($requestData[‘page’][‘id’])) {
$pageId = $requestData[‘page’][‘id’];
echo $pageId;
}
}

Option 4: App Domain / Site URL

<div id='fb-root'></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='addToPage(); return false;'>Add to Page</a></p>
<p id='msg'></p>

<script> 
  FB.init({appId: "APP_ID", status: true, cookie: true});

   function addToPage() {

  // calling the API ...
  FB.ui(
    {
        method: 'pagetab'
    },
    function(response) {
        if (response != null && response.tabs_added != null) {

            $.each(response.tabs_added, function(pageid) {
                  alert(pageid);
            });
        }
    }
  );


  }

</script>

Your app will also receive string parameter app_data as part of signed_request if app_data parameter was set in the original query string in the URL your tab is loaded on.

“https://www.facebook.com/YourPage?v=app_APP_ID&app_data=STRING”

Upload Large Files from Amazon S3 Bucket to Dropbox Folder


Hits: 6601  

Dropbox Uploader is a BASH script (only needs cURL) which can be used to upload, download, list or delete files from Dropbox, an online file sharing, synchronization and backup service.

Usage: ./dropbox_uploader.sh COMMAND [PARAMETERS]…

Amazon S3 to Dropbox
Amazon S3 to Dropbox

Secure:It’s not required to provide your username/password to this script, because it uses the official Dropbox API for authentication process.

START DROPBOX UPLOADER

# chmod +x dropbox_uploader.sh
# ./dropbox_uploader.sh

It will ask “App key”, “App secret” and “Access level (App folder or Full Dropbox)”

As shell script authorize token…

Please visit this URL from your Browser, and allow Dropbox Uploader
to access your DropBox account:

–> https://www2.dropbox.com/1/oauth/authorize?oauth_token=xxxxxxxxxxxxxxx

Dropbox token for Command Line
Dropbox token for Command Line

If everything go well …

> Access Token request… OK

Setup completed!

Now you can download Amazon S3 Bucket files on server using “wget” then you can run command like…

# ./dropbox_uploader.sh COMMAND [PARAMETERS]…
# ./dropbox_uploader.sh upload /var/www/aws/s3/svnlabs.mp4 /DROPBOX-FOLDER/svnlabs.mp4

I have uploaded media file upto 500MB on dropbox successfully using this shell script 😉

Alternate Options:

You can try Node.js for reading files from Amazon S3 and then upload to Dropbox

Useful JavaScript Tools

http://loose-bits.com/2011/10/16/node-sunny-cloud-library.html
https://github.com/nuxusr/Node.js—Amazon-S3
https://github.com/appsattic/connect-stream-s3

https://github.com/evnm/dropbox-node
https://github.com/sintaxi/node-dbox
https://github.com/dropbox/dropbox-js

Amazon S3 Error Handling


Hits: 5868  

Amazon S3 PHP Class A standalone Amazon S3 (REST) client for PHP 5.2.x using CURL that does not require PEAR.

AWS Management Console Home
AWS Management Console Home

AMAZON S3 (Scalable Storage in the Cloud) PHP CLASS

AWS access info
AWS access info

// AWS access info
if (!defined(‘awsAccessKey’)) define(‘awsAccessKey’, ‘CHANGE-KEY’);
if (!defined(‘awsSecretKey’)) define(‘awsSecretKey’, ‘CHANGE-KEY’);

OO method (e,g; $s3->getObject(…)):
$s3 = new S3(awsAccessKey, awsSecretKey);

Statically (e,g; S3::getObject(…)):
S3::setAuth(awsAccessKey, awsSecretKey);

Warning: S3::getBucket(): [PermanentRedirect] The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

We need to End Point for our S3 Buckets by default it’s s3.amazonaws.com

$s3 = new S3(awsAccessKey, awsSecretKey);

S3 Management Console
S3 Management Console

Else we need to specify here… s3-ap-southeast-1.amazonaws.com

S3 Management Console
S3 Management Console

$s3 = new S3(awsAccessKey, awsSecretKey, true, ‘s3-ap-southeast-1.amazonaws.com‘);

Warning: S3::getBucket(): [60] SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

We need SSL enabled with CURL 😉

OpenSSL phpinfo()
OpenSSL phpinfo()
CURL With OpenSSL phpinfo()
CURL With OpenSSL phpinfo()

For class documentation see:
http://undesigned.org.za/files/s3-class-documentation/index.html

SponsorPay API in PHP


Hits: 3922  

SponsorPay – International Leader in Engagement Marketing and Performance Advertising for the Monetization of Virtual Currency and Digital Content on Social Networks, Online Games, Virtual Worlds and Entertainment Platforms.

Mobile Developers - SponsorPay
Mobile Developers – SponsorPay

Key Features:

* Boost branding and engagement
* Acquire users and improve engagement
* Engage and monetize all your users
* Drive customer acquisition and sales
* Grow revenues with innovative products
* Achieve true glocal monetization

SponsorPay Products

* Offer Wall
* Layover Offer Wall
* Offer Banners
* Offer Bar
* Offer Widget
* BrandEngage

SponsorPay Mobile Offer API

JSON Format
http://api.sponsorpay.com/feed/v1/offers.json?appid=[APP_ID]&uid=[USER_ID]&ip=[IP_ADDRESS]&locale=[LOCALE]&device_id=[DEVICE_ID]&ps_time=[TIMESTAMP]&pub0=[CUSTOM]&timestamp=[UNIX_TIMESTAMP]&offer_types=[OFFER_TYPES]&android_id=[ANDROID_ID]&hashkey=[HASHKEY]

XML Format
http://api.sponsorpay.com/feed/v1/offers.xml?appid=[APP_ID]&uid=[USER_ID]&ip=[IP_ADDRESS]&locale=[LOCALE]&device_id=[DEVICE_ID]&ps_time=[TIMESTAMP]&pub0=[CUSTOM]&timestamp=[UNIX_TIMESTAMP]&offer_types=[OFFER_TYPES]&android_id=[ANDROID_ID]&hashkey=[HASHKEY]

<?php

// Step 1: Gather all request parameters

$page = isset($_REQUEST['page'])?$_REQUEST['page']:"1";
$uid = isset($_REQUEST['uid'])?$_REQUEST['uid']:"svnlabs";
$pub0 = isset($_REQUEST['pub0'])?$_REQUEST['pub0']:"sv";
$appid = isset($_REQUEST['appid'])?$_REQUEST['appid']:"APP-ID";
$device_id = isset($_REQUEST['device_id'])?$_REQUEST['device_id']:"DEVICE-ID";
$ip = isset($_REQUEST['ip'])?$_REQUEST['ip']:"IP-ADDRESS";
$apikey = isset($_REQUEST['apikey'])?$_REQUEST['apikey']:"API-KEY";
$format = isset($_REQUEST['format'])?$_REQUEST['format']:"json";

$requestring = 'http://api.sponsorpay.com/feed/v1/offers.'.$format.'?';

$d = array(   
        'appid' => $appid,
        'device_id' => $device_id,
        'ip' => $ip,
        'locale' => 'en',
        'page' => $page,
        'pub0' => $pub0,
        'timestamp' => time(),
        'uid' => $uid,
    );
    
    
//Step 2: Order all request alphabetically    
    
ksort($d);

//Step 3: Concatenate all request parameters

$params = '';

foreach($d as $k=>$v)
{
  $params .= $k."=".$v."&"; 
}    

//Step 4: Concatenate the resulting string with your API Key
//Step 5: Hash the resulting string using SHA1

$hash = sha1($params.$apikey);

$url = $requestring.$params."hashkey=".$hash;

echo file_get_contents($url);

?>

 

SponsorPay is a really good solution for social media platform using more engaging ad units than traditional social media formats.