Showing posts with label rtsp. Show all posts
Showing posts with label rtsp. Show all posts

Tuesday, 15 February 2011

The cross-browser challenge

Web standards have been growing fast thanks to the World Wide Web Consotrium and the community around it. It's amazing to see what a browser can do with a few lines of html and javascript. But.. What if you need to deliver a new feature to users and you can't implement it using current web standards ?

This often means you will have to develop your own "browser plugin" using native code. What you would like is to have a plugin that runs on every browser, on every operating system, on every hardware architecture.

In order to deliver encrypted RTSP content inside user's browser, WimTV had to face (and is facing) the very same problems. Just like Adobe Flash we had to implement our own piece of software that runs side by side with the browser, rendering contents in a child window.

While there are a lot of browsers available, it's is possible to group them by the rendering engine they use.

- Webkit: Chrome, Safari, Android Mobile Browser, many others
- Gecko: Firefox, Camino
- Trident: Internet Explorer, other Microsoft products

Luckly most Webkit and Gecko browsers implement NPAPI for their plugins.

NPAPI is a cross-platform plugin architecture that was introduced by Netscape and then received many contributions by Mozilla and Google. Basically it defines a set of APIs that must be implemented on both browser and plugin side in order for them to interact. Mozilla currently offers the best SDK and documentation to help developers write their plugins using C or C++.

WimTV Browser Plugin uses NPAPI to support Webkit and Gecko powered browsers, and a NPAPI-ACTIVEX wrapper in order to work on Microsoft Internet Explorer.

The wrapper is called PluginHostController. It is opensource and the code is available from Mozilla servers. It consist of an ActiveX plugin written in C++ and implementing some basic funcions of NPAPI. Unfortunately it was written some years ago and it is not maintained. In the meantime NPAPI evolved adding some features we used in our plugin, such as Scriptable APIs allowing Javascript interaction. In order to use it we had to develop the missing parts and then bundle wrapper and plugin inside a cab file.
Davide Bertola

Tuesday, 25 January 2011

How does your pc plays wim.tv videos?

So, when you first come on the wim.tv page was asked you to download a browser plugin, then you're able to watch videos. But what really happens in this process?  What you downoad is a gstreamer-based rtsp player, that receives multimedia contents from the network and allows the browser rendering them within a web page.

Real time streaming protocol and wim.tv

RTSP (http://tools.ietf.org/html/rfc2326) coupled with Real Time Protocol (http://tools.ietf.org/html/rfc3550) is the network protocol used by wim.tv to delivery videos to the end user. RTSP is a real live protocol, that means that the media supplier could create the video at the very same time it streams it. This is implemented by sending a single frame of the video at the time, so in every moment the server could decide what is the next frame to be sent. In the others web-based video streaming platforms each video is an indivisible file, that must be streamed as-is.

Then RTSP allows to insert advertisements within the video in a totally smooth way, without overlaying, switching through different streams or other tricks. In fact, when an adverticement starts, the player just keep on receiving and frames, without ever notice if those frames are part of the video or the adverdicement. Besides improving playback performances, this ensures the advertisers that end users cannot skip the adverticements.

Another thing wim.tv player is able to do is to decrypt encrypted videos. Pay per view premium videos are streamed in an encrypted form, and can be played only by authorized users. If a malevolent user tries to save video data from the network the only thing he could retrieve is video of solid gray frames. But if you're allowed to play the same video, wim.tv browser plugin will decrypt it for you. In that case, each frame of the video is received, decrypted and played. The entire operation is enough fast that you'll never notice that is happening when you watch a video.
Alessio Lagonigro