IntroWarning: The information on this page is not up-to-date, contact Diego or Arno for current info. Up-to-date info on how to use the plugin can be found in P2P-Next's D6.5.3 deliverable. It also explains how to build the plugin from scratch (note: described configure flags wrong, see p2pnext-win32-setup-from-co.sh).
The SwarmPlayer Browser plug-in (SwarmPlugin) is a media player plug-in for Internet Explorer (Firefox and Safari in the next future) based on the VLC plug-in. The SwarmPlugin incorporates P2P technology (from now on P2P Core or Core) developed by TUDelft University, Vrije Universiteit, and others. The advantages of integrating P2P networks and VideoOnDemand (from now on VOD) should be known and are not going to be discussed here. This document presents the architecture from a general and an in depth point of view. Since the current status of the Plug-in is under development, I'll give some attention on how to reproduce a building and installation environment. The classid in this example is incorrect. It should be clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921 ArchitectureOverviewAs it's possible to see from the following picture, the general architecture is composed by two main components:
The BG Process is intended to provide P2P download and streaming functionalities to the Plug-in while the Plug-in is responsible for handling the playback and the user interaction. It's easy to understand that the architecture has been modeled as a client/server architecture where the Plug-in is the client and the BG is the server. Plug-in / BG Process interactionThe BG and the Plug-in communicate through two main channels:
The TCP connection is used by the plug-in to send requests to the BG, and by the BG Process to send commands to the Plug-in. The communication protocol is really basic:
Here is shown an interaction scheme between Plug-in / BG / P2P Core: The Background ProcessOverviewThe BG Process is a Windows executable (.exe) build up from python sources. As already said it's basically a server providing VOD (and P2P) features. The plug-in must be able to launch the BG Process in the case the BG is not up yet. After the BG has been launched by the first plug-in instance, it should keep serving in background until a manual shutdown is performed (through the Systray Icon). The reason to keep the BG alive is of course to guarantee seeding time after service (video streaming) consumption. Through the systray icon it's possible to interact with the BG Process, setting the upload rate limit, monitoring the current download status and speed and requesting the BG to shutdown. An alternative could be to provide interactivity/monitoring features to the BG Process through a web interface. The Plug-inOverviewThe Plug-in is an ActiveX control based on the VLC Internet Explorer plug-in (vlc-0.9.5). When the browser renders the web page and an <object> tag is found in the html code, the browser loads the plug-in associated to the "classid" parameter of that tag. In our case the "classid" is "E23FE9C6-778E-49D4-B537-38FCDE4887D8". Further studies are needed to understand how to generate and register a new CLASSID to be associated to the SwarmPlugin (since the current one is associated to the VLC plug-in) As soon as the Plug-in is loaded in the browser, a connection with the BG Process is established and the communication between the two components starts. If the Plug-in can not connect to the BG Process, it tries to launch a new BG instance and to connect again. At this point the connection is established and the session between Plug-in and BG starts. As already said the communication protocol between the two components consists on requests (from Plug-in to BG) and commands (from BG to Plug-in). This mechanism is asynchronous, this means that after the Plug-in sends a request, commands can be received anytime.
The interaction between the user and the Plug-in is identical to the
Vlc plug-in. For details refer to the Vlc documentation: SourcesThe starting point of the Plug-in development is vlc-0.9.5. The source code of the VLC package contains a 'projects/activex' directory where the code for building the 'axvlc.dll' is stored. This library is the plug-in its self and is the one that is loaded into the browser. The ActiveX control is composed by several files implementing different features of an activex control. The 'main' files are plugin.h, plugin.cpp. These are the only 2 files patched to let the plug-in communicate with the BG Process. The patch consist in adding a TriblerControl object to the VLCPlugin class. We are going to see what does this means by giving an overview of the few classes involved:
The EnvironmentSVN repository
SwarmPlugin
The precompiled binaries can be found in here.
Background Process Runtime environmentThe runtime environment is not completely defined yet. It's reasonable to think that the installation path will be something like C:Program FilesSwarmPlugin
it will contain the BGProcess executable and libraries, the Plug-in
(axvlc.dll) and the Vlc libraries. One registry entry will be
needed: this item will contain the path through which the Plug-in can find the BGProcess and run it. How to buildBackground Process
To build the BG Process you have to check out the svn repository:
go in the mainbranch directory just created and run on the console: this requires you to have python and the py2exe extension installed. Once done, you can find the dist directory containing the BG Process executable and libraries. Plug-inAs already mentioned, the Plug-in is a patched version of the VLC (0.9.5) plug-in. VLC is software native for Linux, so to build up a Windows version you'll have to cross-compile from Linux to Windows with the Mingw compiler (for example) or alternatively use a Cygwin environment.
To compile the SwarmPlugin you have to compile the whole VLC source tree. Since this task may be tricky we provide a script for creating a building environment, patching VLC and compile the SwarmPlugin. As already stated the script is vlc_win32_setup.sh and the patch file is vlc-0.9.5_swarm_plugin.patch. Create a new directory, place these files in it, run the vlc_win32_setup.sh and follow the instructions. Important: this procedure hasn't been tested on a clean environment, you may find problems during the configuration phase. How to install
We provide you with a binary package.
This package contains a vlc.win32.nsi NSIS script to build an autoinstaller.
Create your autoinstaller and run it. Remember to check the activex plugin as component to install and
change the destination directory to C:Program FilesSwarmPlugin (preferably).
Place the BG Process you built with the "dist" directory (read "How to build" section) preferably
under C:Program FilesSwarmPluginBGProcess .
Then create a Windows registry (with regedit) under HKEY_LOCAL_MACHINESoftwareSwarmPlugin
with BGProcessPath as key and the path where you copied the BG Process as value. Example: Now you can try to open this page with Internet Explorer. An Interesting FrameworkAs it's possible to understand from the architecture description of the Plug-in, the TriblerControl combined with the BG offers a simple interface to the P2P core. Such framework would allow developers to implement their own VOD software based on torrent/P2P technology in a really simple way. Apart from the SwarmPlugin, other possible uses could be:
To implement such a feature you just have to include the TriblerControl in your software in this way: /* Initialize TriblerControl */ TriblerControl * triblerControl = new TriblerControl(); triblerControl->startup(); /* Register callback functions */ triblerControl->regEventCB< MyClass >( EV_PLAY, &myClassObj, &MyClass::onPlayCmd ); triblerControl->regEventCB( EV_PAUSE, &myStaticFunction ); register your callbacks for every event you want to handle:
Todo and open issues (current status)
Web content download acceleratorThe idea is to merge normal HTTP downloading with P2P. The first time a user completes a normal HTTP download, he creates a torrent out of it and notifies the tracker. When the second user downloads the same resource through HTTP, a P2P plug-in integrated in the web browser starts to look for other peers sharing the same content. At this point the resource is going to be downloaded both through HTTP and BitTorrent. A service gives the root-hash of the torrent providing a security hash-checking mechanism (see MerkleHashes for more details). Attachments
|