Home  >  

Wow, Video in Flex 4 is easy!

Author photo
AddThis Social Bookmark Button
I was experimenting with Flex 4 this evening, and I realized something -- Incorporating video in your application is now really, really, really easy. Don't believe me, read on...

This is a VERY basic example showing how to embed video into your Flex 4 application. There is no custom skinning or layout. It's just the basics, however it was astonishingly easy. First, take a look at the application below. It is a full featured video player that has play/pause/stop, volume, mute, fullscreen, and a scrub bar.

It is definitely more effort to get it polished and looking the way you will want it to in your final applications, but here's all it takes just to get the video into your application. This is quite possibly the most basic, yet functional application I've ever built:

<?xml version="1.0" encoding="utf-8"?>
<s:Application
	xmlns:fx="http://ns.adobe.com/mxml/2009" 
	xmlns:s="library://ns.adobe.com/flex/spark">
	
	<s:VideoPlayer 
		source="video.flv"
		horizontalCenter="0"
		verticalCenter="0"
		autoPlay="false" />
	
</s:Application>
Note: The original video came from here.

___________________________________
Andrew Trice
Principal Architect
Cynergy Systems
http://www.cynergysystems.com

Read more from Andrew Trice. Andrew Trice's Atom feed

Comments

18 Comments

Dev said:

Oh, the default controls are really ugly .... Can we customize them ?

Rich Tretola said:

Amazing that it took until Flex 4 to include some easy to use video controls. :-)

Andrew Trice said:

Yes, everything is customizable.

Michael Lallemont said:

I noticed that you still have to change the HTML template to include the allowFullScreen parameter so that the Fullscreen button actually works without a player security violation. Is there more control over this in version 4? It would be nice if you didn't have to manually edit the HTML template to do various things, such as pass flashvars parameters and allow fullscreen. I can't wait to actually use Flex 4 and Flash Catalyst. I'm very excited about what Adobe is doing and I think it will produce more work out there for us Flex developers.

samBrown said:

That's a pretty big pay-off for such little code. Any fully skin-able? very cool!

Ryan Frishberg said:

Video in Flex 4 is definitely getting good upgrade. We're still actively working on it, and if you take a more recent build from the trunk, you'll see the skin's gotten a major upgrade (also the allowFullScreen should be in the index.template.html file). And because of the new skinning architecture in Spark, it'll be super easy to customize the skin to your liking.

Shawn Makinson said:

Flexbuilder 4 beta soon.....pretty please. I am starting an air project and I would love to use v4. I'm still debating on my mix of flex and html and v4 may shove me one way or the other.

Joeflash said:

How come your controls show up differently than the default controls for this example, using almost identical code?
http://blog.flexexamples.com/2009/05/05/muting-the-volume-on-a-spark-videoplayer-control-in-flex-gumbo/

Joeflash said:

How come your controls show up differently than the default controls for this example, using almost identical code?
http://blog.flexexamples.com/2009/05/05/muting-the-volume-on-a-spark-videoplayer-control-in-flex-gumbo/

Ryan Frishberg said:

Joeflash,

That's the new version of the skin. The skin you see here was just a really simple skin to get the controls working and functioning. There are still some bugs in the video player that we're trying to iron out soon, and there are still a few more tweaks to the skin that need to happen.

As always, you can monitor the bugs through JIRA at http://bugs.adobe.com/flex/ , and you can download the latest trunk from http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/ .

-Ryan

Andrew Trice said:

I'm probably just using an older build. As Ryan mentioned above, it would look a lot different if I grabbed the latest build.

Tink said:

It was crazy that Adobe didn't make it easy to use video in previous versions, when its video that really pushed the player penetration.

That said we've always just wrapped the FLVPlayback in a UIComponent.

Dan Orlando said:

Thanks for this Andrew, you da man!

I've been looking all over for something like this.

You Rock.

- DanO

Paul said:

This is great news!

It is definitely a very good improvement from the VideoDisplay component in Flex 3.

Thanks for sharing.

marouane said:

pleas somone of you know how to put a video in a fullscreen with flex builder 3
please.

AlCapone said:

hi guys,

i dont really understand how can u get that skinned video player, without changing anything in the code?

is this an illusion or you just make fun with people?

Leave a comment


Tag Cloud

iPad

What's your take on the iPad? (Putting aside the Flash/iPad flame war)

Answer

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.