Install SSL Letsencrypt on Wowza Server HLS Stream

I am running webserver / domain on HTTPS and Wowza Media Streaming Server on HTTP (Non-SSL) so I am getting Error for LIVE / VOD HLS stream Files “Cannot load M3U8: Unable to fetch HTTP resource over HTTPS”

HTTP stream
http://origin.domain.com:1935/live/myStream/playlist.m3u8

HTTPS stream – Needs to setup
https://origin.domain.com:1443/live/myStream/playlist.m3u8

Install Let’s Encrypt SSL Certificates
Free SSL Certbot

=> As I have installed SSL on NGINX … I am running NGINX webserver on 443 (HTTPS) … but wowza is not configured for SSL still

Try to find SSL key in Let’s Encrypt Certificate Directory

# ls /etc/letsencrypt/live
# ls /etc/letsencrypt/live/origin.domain.com
cert.pem chain.pem fullchain.pem privkey.pem README

cert.pem: Server Certificate
chain.pem: Root and Intermediate Certificates
fullchain.pem: Combination of Server, Root and Intermediate Certificates (replaces cert.pem and chain.pem)
privkey.pem: Private Key (don’t share)

# stat /etc/letsencrypt/live/origin.domain.com/fullchain.pem
File: ‘/etc/letsencrypt/live/origin.domain.com/fullchain.pem’ -> ‘../../archive/origin.domain.com/fullchain3.pem’
Size: 50 Blocks: 0 IO Block: 4096 symbolic link
Device: ca01h/51713d Inode: 2754252 Links: 1

Wowza Configuration

Special Thanks to Robymus who made java converter file “wowza-letsencrypt-converter” to convert SSL to an JKS file.

# cd /usr/local/WowzaStreamingEngine/lib
# wget https://github.com/robymus/wowza-letsencrypt-converter/releases/download/v0.1/wowza-letsencrypt-converter-0.1.jar

– The letsencrypt-live-path parameter defaults to /etc/letsencrypt/live

Make sure you have Java 8 installed

# apt-get install oracle-java8-installer

# cd /usr/local/WowzaStreamingEngine/lib
# java -jar wowza-letsencrypt-converter-0.1.jar -v /usr/local/WowzaStreamingEngine/conf/ /etc/letsencrypt/live/

Make sure you will have below files in /usr/local/WowzaStreamingEngine/conf/

– origin.domain.com.jks
– jksmap.txt

– File jksmap.txt have domain to keystore mapping will be used in the VHost.xml of Wowza Streaming Engine.
– JKS password will be ‘secret’.

Now update Wowza file /usr/local/WowzaStreamingEngine/conf/VHost.xml for Wowza HLS M3U8 file

Open Wowza VHost.xml and search 443 HostPort and comment out the <!– before HostPort and –> at the end of HostPort

I am using port 443 already for NGINX SSL HTTPS … so now I am using port 1443 for Wowza HLS M3U8

<!-- 443 with SSL -->
            <HostPort>
                <Name>Default SSL Streaming</Name>
                <Type>Streaming</Type>
                <ProcessorCount>${com.wowza.wms.TuningAuto}</ProcessorCount>
                <IpAddress>*</IpAddress>
                <Port>1443</Port>
                <HTTPIdent2Response></HTTPIdent2Response>
                <SSLConfig>
                    <KeyStorePath>${com.wowza.wms.context.VHostConfigHome}/conf/origin.domain.com.jks</KeyStorePath>
                    <KeyStorePassword>secret</KeyStorePassword>
                    <KeyStoreType>JKS</KeyStoreType>
                    <DomainToKeyStoreMapPath></DomainToKeyStoreMapPath>
                    <SSLProtocol>TLS</SSLProtocol>
                    <Algorithm>SunX509</Algorithm>
                    <CipherSuites></CipherSuites>
                    <Protocols></Protocols>
                </SSLConfig>
                <SocketConfiguration>
                    <ReuseAddress>true</ReuseAddress>
                    <ReceiveBufferSize>65000</ReceiveBufferSize>
                    <ReadBufferSize>65000</ReadBufferSize>
                    <SendBufferSize>65000</SendBufferSize>
                    <KeepAlive>true</KeepAlive>
                    <AcceptorBackLog>100</AcceptorBackLog>
                </SocketConfiguration>
                <HTTPStreamerAdapterIDs>cupertinostreaming,smoothstreaming,sanjosestreaming,dvrchunkstreaming,mpegdashstreaming</HTTPStreamerAdapterIDs>
                <HTTPProviders>
                    <HTTPProvider>
                        <BaseClass>com.wowza.wms.http.HTTPCrossdomain</BaseClass>
                        <RequestFilters>*crossdomain.xml</RequestFilters>
                        <AuthenticationMethod>none</AuthenticationMethod>
                    </HTTPProvider>
                    <HTTPProvider>
                        <BaseClass>com.wowza.wms.http.HTTPClientAccessPolicy</BaseClass>
                        <RequestFilters>*clientaccesspolicy.xml</RequestFilters>
                        <AuthenticationMethod>none</AuthenticationMethod>
                    </HTTPProvider>
                    <HTTPProvider>
                        <BaseClass>com.wowza.wms.http.HTTPProviderMediaList</BaseClass>
                        <RequestFilters>*jwplayer.rss|*jwplayer.smil|*medialist.smil|*manifest-rtmp.f4m</RequestFilters>
                        <AuthenticationMethod>none</AuthenticationMethod>
                    </HTTPProvider>
                    <HTTPProvider>
                        <BaseClass>com.wowza.wms.http.HTTPServerVersion</BaseClass>
                        <RequestFilters>*</RequestFilters>
                        <AuthenticationMethod>none</AuthenticationMethod>
                    </HTTPProvider>
                </HTTPProviders>
            </HostPort>

Now Restart Wowza Server

# service WowzaStreamingEngine restart

Make sure you have also opened port 1443 on your firewall.

Now Wowza HLS M3U8 will work like HTTPS stream
https://origin.domain.com:1443/live/myStream/playlist.m3u8

Install Streaming Audio Server With Icecast 2.3.3

I need to install streaming audio server with Icecast (OGG/MP3) for one of my great client in service of http://html5.svnlabs.com/. Icecast was designed to stream any audio file using ices and icegenerator for MP3 and OGG/Vorbis audio files.

HTML5 MP3 Player with Playlist
HTML5 MP3 Player with Playlist

I already did lot of work using Shoutcast, SAMCast and SAM Broadcaster, Its very easy to use audio casting server online.

Today we will try to install Icecast 2.3.3 on CentOS x86_64 Server…

icecast is free server software for streaming multimedia.
icecast is free server software for streaming multimedia.

Setup Icecast Server

Download source and rpm needed

# yum groupinstall “Development Tools”
# yum install -y curl-devel libtheora-devel libvorbis-devel libxslt-devel speex-devel libxslt
# rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# cd /home
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
# mkdir -p /usr/src/icecast
# cd /usr/src/icecast
# wget http://downloads.xiph.org/releases/icecast/icecast-2.3.3.tar.gz

Unzip Icecast source

# tar xf icecast-2.3.3.tar.gz
# cd icecast-2.3.3

Configure, Compile and Install

# ./configure –prefix=/opt/icecast/2.3.3
# make
# make install

You might find icecast binary .. please confirm 😉

# ls /opt/icecast/2.3.3/bin/

Configure icecast with icecast.xml
# cd /opt/icecast/2.3.3/etc
# vi icecast.xml

Find more help here to setup xml file http://icecast.org/docs/icecast-2.3.1/icecast2_config_file.html

Create icecast user & group

# groupadd -g 200 icecast
# useradd -d /var/log/icecast -m -g icecast -s /bin/bash -u 200 icecast

Before start icecast server check permission and make log folder
# mkdir -p /var/run/icecast
# chown -R icecast:icecast /var/run/icecast

Start the icecast server

# /opt/icecast/2.3.3/bin/icecast -c /opt/icecast/2.3.3/etc/icecast.xml -b   (background)

You will find Icecast server running here
http://Server-IP:8000/

Icegenerator – MP3 streaming client

Compile libshout and lib3lib (ID3 support), run ldconfig

# cd /usr/src/icecast
# wget http://downloads.us.xiph.org/releases/libshout/libshout-2.3.1.tar.gz

# tar xf libshout-2.3.1.tar.gz
# cd libshout-2.3.1

# ./configure –prefix=/opt/icecast/2.3.3
# make
# make install

Install icegenerator

# cd /usr/src/icecast
# wget http://netcologne.dl.sourceforge.net/project/icegenerator/icegenerator/0.5.5-pre2/icegenerator-0.5.5-pre2.tar.gz
# tar xfz icegenerator-0.5.5-pre2.tar.gz
# cd icegenerator-0.5.5-pre2

# ./configure
# make
# make install

Now configure icegenerator to create MP3 radio station

# vi /usr/local/etc/svnlabs

IP=127.0.0.1
PORT=8000
SERVER=2
MOUNT=/svnlabs
PASSWORD=password***
FORMAT=1
MP3PATH=m3u:/var/www/html/svnlabs.m3u
LOOP=1
SHUFFLE=1
NAME=SVNLabs MixStreams
DESCRIPTION=SVN Labs Softwares
GENRE=svnlabs
URL=http://Server-IP:8000/
LOG=2
LOGPATH=/var/log/icecast/icegen.log
BITRATE=48000
SOURCE=source

You can even use MP3 folder path

MP3PATH=pth://var/www/html/songs

Create playlist file

# vi /usr/local/etc/svnlabs.m3u

/var/www/html/songs/svnlabs1.mp3
/var/www/html/songs/svnlabs2.mp3

Or try ….

# find /var/www/html/songs/ -name “*.mp3” > /var/www/html/svnlabs.m3u

Make sure you have setup all paths
# su – icecast -c “export LD_LIBRARY_PATH=/opt/icecast/2.3.3/lib:$LD_LIBRARY_PATH; /usr/local/bin/icegenerator -f /usr/local/etc/svnlabs”

Get more help from here for icegenerator variables http://www.becrux.com/index.php?page=projects&name=icegenerator

http://Server-IP:8000/svnlabs

Start other radio station using Running Icecast Server

# /usr/local/bin/icegenerator -f /usr/local/etc/indie

Icecast Streaming Media Server
Icecast Streaming Media Server

Make New Application in Red5

1. Make a new directory “svnlabs” under the webapps directory, it will be name of the application “svnlabs”.

Red5 New Apps
Red5 New Apps

2. Create a sub-directory called WEB-INF

– red5-web.properties
– red5-web.xml
– web.xml

webapp.contextPath=/svnlabs
webapp.virtualHosts=*, localhost, localhost:8088, 127.0.0.1:8088

Download “svnlabs” Red5 App here…

3. Restart Red5 Server

SponsorPay API in PHP

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.

What is VAST?

Digital Video Ad Serving Template (VAST) is specification to standardize the communication requirements between video players and the ad servers released by Interactive Advertising Bureau (IAB).

what is vast?
what is vast?

VAST data structure is an XML template declares:

* How ad creatives play?
* What to track ad played?

Sample VAST in JavaScript

<script type="text/javascript">
    var options = {
    ads: {
        'skipAd': {
        'enabled': true,
        'timeOut': 5
        },
        'servers'  : [
        {
            'apiAddress': 'vast.xml'
        }
        ], 
        'schedule' : [
        {
            'position' : 'mid-roll',
            'startTime': '00:00:07'
        },
        {
            'position' : 'post-roll'
        }
        ]
    }
    };
    _V_("video", options);
</script>

Screenshots of Video Ads using VAST

VAST Video Ads
VAST Video Ads
VAST HTML5 Video Ads
VAST HTML5 Video Ads
Total Video Ads
Total Video Ads
Android HTML5 Video Ads
Android HTML5 Video Ads

Thank you for visiting svnlabs.com, If you have any questions regarding the contents published in svnlabs.com then kindly contact us via email, we appreciate your feedback and promise you better services…

Email: info [at] svnlabs.com

Mobile: +919928673578

Skype: svnlabs

Twitter: http://twitter.com/svnlabs

FaceBook: http://www.facebook.com/svnlabs

Linkedin: http://www.linkedin.com/in/svnlabs

Concentrate > Observe > Imagine > Launch