How to play HLS with JWPlayer

In this post we will show you a simple way how to play HLS into web browser with JW PLayer – the free version.

Even on JW Player website is saying you need the Premium version for HLS, we found it is working also with the free version together with HLSprovider plugin.

We assume the root website is in /var/www/html.

First, you must download jwplayer-6.7 from and save the archive in /var/www/html, on the web server.
Unpack the archive:

[code language=”bash”]
cd jwplayer

Clone the HLSProvider plugin:

[code language=”bash”]git clone[/code]

We will create the HTML file where we will display the player:

[code language=”bash”]nano index.html[/code]

and paste the code below (of course you need to adjust it, replacing with your real domain name or IP):

[code language=”bash”]
<script type="text/javascript" src=""></script>
<div id="player">Loading the player…</div>

<script type="text/javascript">
playlist: [{
// file is the url to m3u8 file
provider: ‘’,
width: 640,
height: 480,
primary: "flash"


That’s all. Now point your browser to and you can play the video.
This example ‘should’ work both on iOS devices and PCs with Flash support.

You can see the example here – if the server is up

You can read also the blog post about HLS Video on Demand streaming

linux Programming

How to do VoD with nginx

You can read my last post on LeaseWeb Labs – Streaming Video on Demand with nginx and RTMP Module


Web server in one line of bash

If you want to quickly save a file through http but you don’t want to install a web server, you can just use netcat.
You can run:
[code language=”bash”]
while true; do { echo -e ‘HTTP/1.1 200 OK\r\n’; cat index.html; } | nc -l 8080; done

index.html can be any file you want to serve it.

You can access it after that as: http://host_ip:8080/

Programming python

Install MySQLdb for Python 2.x

If you want to install MySQLdb for Python 2.x, without using the package manager of your Linux distro (Ubuntu in our case), you can do it through pip like this:

First you must to have installed libmysqlclient-dev (and, of course pip)

[source language=”bash”]
sudo apt-get install libmysqlclient-dev

After that execute this two commands:

[source language=”bash”]
sudo easy_install -U distribute
sudo pip install mysql-python

Test if is working:
Type in the command line:

[source language=”bash”]

and in the python console:

[source language=”python”]
>>> import MySQLdb
>>> help(MySQLdb)

That’s all. Enjoy!

Programming symfony2

Load bundle without composer.json in Symfony2.3

This is how I loaded a legacy budle without composer.json in a custom location for my Symfony2.3 project with composer.

In one of my Symfony2.3 projects I needed to use an old external bundle. This legacy bundle (from Symfony2.0) hasn’t a composer.json file and in my case I can not add one.
Anyway, I wanted to use composer and its autoloader also for this bundle in order to keep things simple for me.

Let’s assume I wanted to add TwitterClientBundle and its namespace is: Razvan\TwitterClientBundle

For this I added in my composer.json the following:


"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": {
"": "src/",
"Razvan\\TwitterClientBundle": "vendor/razvan/twitter-client-bundle"
"repositories": [
"type": "package",
"package": {
"name": "razvan/twitter-client-bundle/Razvan/TwittereClientBundle",
"version": "4.4.3",
"source": {
"url": "",
"type": "git",
"reference": "master"
"require": {
"razvan/twitter-client-bundle/Razvan/TwitterClientBundle": "*"


After that I ran:

[bash]php composer.phar update razvan/twitter-client-bundle[/bash]

and the bundle was added in /path/to/yourproject/vendor/razvan/twitter-client-bundle/


razvan@main2:/var/www/twitter/vendor/razvan/twitter-client-bundle$ tree
— Razvan
— TwitterClientBundle
— DependencyInjection
   — RazvanTwitterClientExtension.php
— RazvanTwitterClientBundle.php
— Manager

After that I enabled the bundle in AppKernel.php

[php]new Razvan\TwitterClientBundle\RazvanTwitterClientBundle()[/php]

and that was all.

– Maybe there are better solution, but I did not find them yet.
– The bundle RazvanTwitterBundle doesn’t exist on Github.

P.S. Somebody else wrote a similar post in the past.


Tip: List vs. Set in Python

In Python, if you have a “list” with a lot of members and you need to do many membership checks, it will be better to use a “set” instead, because the checks are linear for lists and constant for sets.