inside the head of aYo Binitie II
RTMFP:Developing peer to peer applications with Flash Media Interactive Server

Adobe always manages to excite me with the introduction of new features into the Flash Media Interactive Server. I must confess though that none has excited me in recent times as much as the introduction of the peer to peer protocol RTMFP which has now has public viewing in the Adobe Stratus Cloud server. True RTMP has managed to carry us this far but, the inherent problems of a TPD hub server to distribute content was becoming all too obvious to see. In truth the client to server to client model was just no longer efficient enough to cope with the expectation of a user base that now expects all video to be desktop application quality. True a myriad of deployment techniques and the geo-location of server clusters helped to solve this problem somewhat but, at a price too costly for the average user. Problem now solved with the real Time Messaging Flow Protocol, a UDP protocol that allows Flash Player 10 to communicate client to client. Security is maintained by the server which acts a a mediator to authenticate and exchange data keys between consenting users. The result is startling. A video chat application I built with a camera encoded value of 960 x 720 x 10 streamed with virtually no lag in motion or audio. My test partner was my long time friendand tag team partner Prof Bill Sanders and we talked for at least 90 minutes with no change in quality whatsoever. The screen shot above was at full screen.
Development techniques are however not the same as defacto FMIS development as you have access to only the main classes Stream/NetStream, Application and Client (I may have missed some out). Notably you do not have access to Remote Shared Object interaction (for the moment). This makes for some interesting jiggery-pokery to distribute data to multi-users. In this, I have found the Application.broadcastMsg,NetStream.send methods as well as data binding techniques invaluable. Without a shadow of a doubt other creative ways of routing the data will show up as people get more comfortable. In addition you have the same old echo problems so a headset is still absolutely necessary. You also cannot access the raw data of the streams audio and video (for the time being, I hope). Visit http://labs.adobe.com/wiki/index.php/Stratus for more information. You can procure a Developer key there and start to try out the protocol for yourself
I will put up the code for this video chat application once I've cleaned up the mess I created in developing it as well as a demo application you can try out.
Bugbears, the Finite State Engine and MagicMVC

Bugbears is finally live. The application developed for CBBC provides children with a platform to air their views on a number of topics anonymously. They are provided a voice recording studio where they can select a creature to which their recorded voices would provide the voice track. An animated creature is then created and posted to the site. Visitors to the site can play back these 'bugbears' and tag then with 'hugs', 'respect' or 'feel the same'. A few more features on the site provide the visitor with the ability to leave advice or feedback on the various subjects.
This CBBC project has taken half of the year in development and required nay demanded my complete attention over the time. For the most part it as been 1 long 6month week with lots of 48 hour development sessions generously sprinkled with lots of hair pulling and head scratching and very hairy moments. Lots of lessons have been learned during the process from development and project management perspectives. All I can say is that I now know what it must be like to be a shirt in a washing machine in a hot wash. Nonetheless it has been a wonderful experience and seeing the project develop from use-case diagrams to release version has made all the work well worth it. My colleague and co developer Valentyne Derkach has been a boon and a dream to work with and I often wonder what it would have been with out him on board. Valentyne you rock!!
On a personal note this project allowed me to test the efficacy of MagicMVC (an mvc based scaffolding I developed for Magic Lantern Productions) and explore the possibilities offered by a Finite State Engine and the State design pattern. Indeed the Bugbears application is a Finite State engine managing a number of states (views) which are pulled in at the users request. It provided scaleability and robustness to the application and allowed us to deal comfortable with team development and the constant stream of changes to the application spec which inevitably come as the application was being developed. The use of an interface for state change rather than the use of concrete classes provided the flexibility to manage the intricate retrieval and removal of various classes required to make the system work.
Magic MVC provided the scafolding for tthe large views and because it provides a Flash Media Server hook in its model it allowed us manage NetConnections and Nestreams very comfortably. There is still a lot to be learned and as we put the in finishing touches, Val and I muse over how much better the site could have been if we had done things differently, if we had more time, if we planned better. I guess this is a good thing as it shows we are still developing and are searching to improve. We hope to release MagicMVC in the near future, as we have both found it very useful.
PulseAudio patch for Flash in Ubuntu-Studio prevent live Flash Media Interactive Server NetStreams
Ubuntu and Ubuntu- Studio have the PulseAudio server as the default sound server. The Ubuntu Wiki documentation states
"There may be problems with getting sound from Adobe Flash v. 9 and earlier, Wine and Skype when these applications use the ALSA protocol. The sound is supposed to go through the "pulse" plugin in ALSA, that passes it to PulseAudio, where it get mixed with all other sound, and passed on to a audio interface.
The problems seems to be related to the pulse plugin in ALSA, and the special ways these apps uses ALSA.
Currently there are three patches for "pulse" that probably can solve the problems with Wine combined with ALSA/pulse."
As usual in "itchy finger" mode I could not resist trying out the PulseAudio patch for Flash Player 9+ in the hope that somehow this enhanced sound server would improve the Flash Player sound-scape. I went to Synaptic and installed the libraries to assist Flash Player 9 deploy PulseAudio. Everything seemed to go as sweet as a nut until, I tried to video conference via the myForum2 video conferencing system. I could get no audio from my chat partner irrespective of what we both did to reconfigure sound. Oh she could hear me with no problems at all but I could not hear her at all. I tried out various Flash Media Interactive Server applications I had build with FMS streaming and they worked though, they were all playing back recorded streams. I also tried to chat via Skype and I got errors stating that I had problems with my sound card which, was frankly rubbish. As a last resort I went back to Synaptic and uninstalled the PulseAudio libraries for Flash and yes not I can hear live streams from the Flash Player again. This one is a bit strange though because, I could playback the BBC live news coverage thats is streamed live from Akamai via RTMP - or perhaps its not as live as it should be. I guess that's a discussion for another day. For the moment what is important is the fact that the Flash Player deploys the ALSA algoritthm for sound and the PulseAudio patches for the moment create a new set of problems. My recomendation for the moment 'Do not patch'. The problems I found were in areas I usually work in, who knows what complications you may introduce to your system by patching.
Streaming AAC/MP3 files with Flash Media Server 3
Configuring Red5 server for manual start in Linux
First you need to navigate to the init.d folder
cd /etc/init.d
Stop the Red5 service
sudo ./red5 stop
Remove all the default auto-config settings
sudo update-rc.d -f red5 remove
Finish up by specifying the new config settings (stop always)
sudo update-rc.d -f red5 stop 20 2 3 4 5 .
An untried (untried by me) alternative suggested kindly by Mikko Rantalainen is
"As an alternative, one could specify new config in the second step, for
example:
# start with sequence number 80 at run levels 2, 3, 4 and 5
# stop with sequence number 20 at run levels S, 0, 1 and 6
sudo update-rc.d red5 start 80 2 3 4 5 . stop 20 S 0 1 6 .
I'm not sure about the official run levels for latest debian or ubuntu but, historically runlevel 2 is supposed to be without network connection - so red5 should probably run only at run levels 3, 4 and 5. However, at least default install of Ubuntu 6.06 LTS seems to run at runlevel 2 with active network connection."
My thanks to R.G Manuel and Mikko Rantalainen without whom I would still probably be scratching my head on this one.
Stopping, Starting and Restarting Red5 in Linux
All those who read this little treatise on starting, stopping and restarting Red5 in Linux, you owe this bit of information to him. Okay enough of the waffle.
To begin my distro is Linux Mint (Daryna), Greg is an Ubuntu man. I installed Red5 using the GDebi package installer. Then the 1st hurdle appeared, apparently Red5 was installed successfully but, "Where the Deuce was the damned thing?". As a windows user I expect to see Icons or a start-up link somewhere when I install a service, not in this case. The absence of an install Icon was painfully obvious. After some desperate Googling I managed to find out how to get at the demos, so I could test for the presence of Red5 http://localhost:5080/demos/port_tester.swf. Then the major hurdle, how do I stop the Red5 service. A lenghty session of Googling only brought frustration and desperation. After 3 hours I was irritated and fed up.
Enter Greg the Saviour, and here is the way:
First locate the service by typing the following in your Terminal
cd /etc/init.d
Next type
ls
This will show you all your services. If Red5 is there, you're in business.
To stop Red5, type:
sudo ./red5 stop
If you are successfull you will get the following print out
Stopping Red5 flash streaming server: red5.
To start Red5, type:
sudo ./red5 start
Success will yield the following print out
Starting Red5 flash streaming server: red5.
To restart Red5 type:
sudo ./red5 restart
Successfull you get:
Restarting Red5 flash streaming server: red5.
Thats it folks, if you're new to Linux like moi get ready for the next headache. By the by does any one out there know how I can get my web cam to work in Linux Mint? Once more, thanks G :)
Changing the IP address in Red5
# RTMP
rtmp.host=83.170.114.15
rtmp.port=1935
You can change all the other setting to suit your requirements there.