Showing posts with label flash. Show all posts
Showing posts with label flash. Show all posts

Thursday, March 6, 2008

Silverlight vs. Flash and .NET integration


Two words about this new Technology by Microsoft.
I saw it for the first time near the end of 2007, but I gave it no importance: yeah, cool graphics but, as I'm not a graphic designer and having so little taste in graphics :), I had no interest in learning the fundamentals.
This is the same thing in Flash: in fact in the field I develop, Flash could help me only in the presentation step of my applications, because in the development step server techologies with javascript are enough.

Some weeks ago I came across the 1.1 alpha version of SilverLight, a complete version of the plugin, that can run on all main platforms (Win, MacOS, and a developing version for Linux) and on all main browsers (with only one plugin!!).

The main problem using FLASH with other technologies, such as .NET, is that you need a completely different environment to develop your applet (Flex) and have to use another language for your script (Action Script): moreover it's pretty difficult to generate both ASP.NET code and Flash code server-side, as they are in complete different domains. This can be done using third party solutions (such as SWFSource.NET, from this link) that allow you to generate SWF files server side, but at a too low level and of course without a complete intergration with the .NET technology.

At Microsoft Labs they wrote a scaled down version of the .NET platform to make Silverlight working: this allow you to write your client application in the same way you write your server pages, thus using the same data structures, objects and languages (C#, VB.NET, managed C++, ...), coming in help to the poor butcher programmer.

The framework, fully included in Visual Studio with few operations, comes with a completetly 2D rich model for drawing and responding to events (mouse click and this kind of stuff), some interesting streaming object for the mainly used video/audio standards (and Microsoft offers a 4Giga service of media storage and streaming server functionality in this link for free) fully customizable, a complete animation model and really interesting a full support for web services: this is what you will find in the 1.1 version, as the 1.0 is still something mostly related to graphical and animation manipolations.

No doubt that beeing an alpha release, I bet, there are still a lot of bugs and all the framework is missing some usefull objects not yet implemented, anyway this alpha is paving the way for a great new and useful technology.

Stay tuned for further readings, from your preferred butcher's shop!

Monday, March 3, 2008

[Flash] Flow Player and video random access


Problem: handle random access to a FLV (Flash Video) file using FlowPlayer flash player.

Solution: this article is a sort of How To about how to make random access working using this particular flash palyer (that is open source and well working).

What is random access?
Essentially random access can be seen in most of YouTube videos: you don't have to buffer the entire video, because it's possible to select a specific instant to play that has not been buffered yet!

Simply, but of course it didn't mean to work...

I had to work with already coded FLV files, using ffmpeg (if I'm not wrong they came from a MPEG4 video and MP3 audio). Anyway I haven't never worked with FLV files, but I found them very very interesting; in fact it's possibile to write MetaData just inside the file.
Anyway FlowPlayer, from its site, grants the possibility of random access, so it was not a player's fault if my videos didn't work with random access.

After a full day of searching, finally a flash of knwoledge: there is a free tool, called FLVTool2 that puts inside the file constant metadata to mark up each instant (I suppose it is done each half second or more or less), so random access depends on those markups (and so it is not continous).
To make it possibile this is one of the possibile usage of the tool (inserts meta data in an output file and after the process visualizes metadata content of the file):
flvtool2 -UP inputVideo.flv outputVIdeo.flv

Of course output file is not needed.

This is not all: random access wasn't still working!

After some reading (one inside the FlowPlayer site I haven't seen at first sight) I found the problem: if you want random access you must use a streaming server.
Just this?? What's the problem, sure you can find billions of free streaming server...

Well , yes, there are a lot of them but all in beta or even alpha release, so in my opinion they were not worth for business applications.

Fortunately a google (I love you) result came to save me: Flash Streaming to FlowPlayer using only PHP!!
In few words, using a script linked in that page, you set up a PHP Streaming Server (it simply sends via HTTP the video from the point selected with FlowPlayer) that works very well: I don't know how it is scalable, but in my tests the streaming was fluid and in time.

So if you have my same problem and don't want to spend hundreds of euros to buy a professional streaming server, this is your solution!

And remember, you are never alone: google is always next to you with a confortable word!