video.Maru
by polyGeek polyGeek logo



 

Factory Floor

October 30th, 2007 . by polyGeek

Many words have been used to describe video.Maru for it’s stunning simplicity and yet powerful features - Kohinoor being my favorite.

And many talented designers have used video.Maru to create some great designs.

But just as no one buys a Ferrari Fiorano expecting that the factory floor from which it was produced is as sexy as the car itself. Neither does anyone use video.Maru for it’s well organized building and testing environment. In fact, very few have ever seen the source from which video.Maru is created.

Until now.

Here you are: the video.Maru factory floor.

video.Maru factory floor

If you can stomach that then go ahead and download the source FLA, minus any video content.

I do feel that I should mention that this is really only one third of the visual environment which I get to enjoy working in. Don’t tell my wife, but next year I hope to upgrade to triple 30s. :-)


Get the duration of all your videos in an XML list

October 26th, 2007 . by polyGeek

A video.Maru user came to me with the following question:

How can I display the duration of a video in the linkBTN when using XML to describe a list of videos to play?

There are two ways to do this: One, you could just add a duration tag to the XML along with all the other children of each video node. Then use the video.Maru API to give you the XML and then manually run through each node and apply the value to the appropriate linkBTN.

Note: you can add any tag you wish to the XML: rating, color, viewedCount, whatever. But video.Maru doesn’t know what to do with that data. It doesn’t even look at it. So you’ll have to do that on your own with the API.

I’ve added a few calls to the video.Maru API to help with looping through the linkBTNs.

function getLinkButtonArray():Array
This will return a list of all the linkBTNs that were created from the XML. You’ll need to call this function from inside videoMaruCreationComplete. With this you will have a way to loop through this array and say something like:

In the above function I already have an array of the durations of all the videos - durationsArray. The linkArray contains a reference to each linkBTN. And inside each linkBTN I’ve added a TextField named duration. Here I’m just giving it a text value.

You’ll also notice that I’m using another new API call: videoMaru.formatTime.

function formatTime( s:String ):String
This takes a string that is the number of seconds in the video. If a video has a duration MetaData then it’s in seconds. But you don’t want to tell your users that a video is 175 seconds long. You’d rather tell them that it’s 2:55. That’s what this function does. It returns a string that is properly formated to display your video duration.

Let video.Maru do it for you

Now, if for some reason you can’t add the duration tag to your XML yourself you could have video.Maru do all this for you. With a little help from the API. To get the metaData from a FLV file you need to play it. No way around that. But you don’t have to play the whole thing. Just a tiny bit and you’ll have the metaData that you need.

So what you do is play each video in turn. As soon as the video returns the metaData, via the API, you play the next video, rinse and repeat until done. At each step you store the duration value from the metaData. Then when you’re done you can apply the data you have to each linkBTN as shown in the first case.

Here’s the code that will do that for you:

The downside to all that is the videos flash across the videoWindow as you loop through each video. There are two solutions that I can think of: one, place an image over the videoWindow and then remove it when you are finished looping through all the videos. Note: you will need to place the videoWindow inside a holder clip so that it doesn’t end up on top of your image at runtime.

The second solution is to have two entirely separate versions of video.Maru running. One for your users to see and the other, off stage, for getting the duration data. When you finish looping through all the videos you simply set video.Maru to playing a non-existent video, such as “”. Then you apply the steps from above. It’s all a matter of targeting the correct MovieClips. I’ll leave that as an exercise for the reader. :-)

You’ll need the latest version of the video.Maru SWC to access these new API calls.

Enjoy.


Fix ( temporary ) for youTube streaming

October 21st, 2007 . by polyGeek

I received a handful of emails and comments here at polyGeek.com telling me that youTube videos weren’t streaming through video.Maru any longer.

The good news is that I got it to work again, although it will takes a little more work to get the ID string. The bad news is that Google/youTube can change things around at any time and make it more difficult or impossible to stream their videos through video.Maru. If you are using this feature for your clients I’d be sure to have a backup in case if this happens again. Or should I say when it happens again.

You will need to use the new video.Maru 3.0 beta SWC to make this work.

Since making the change youTube has changed again and the fix doesn’t seem to be working. If the video below plays when you click the play button then it’s working. Otherwise youTube is messing around with things again. Use this feature at your own risk.

Here’s the new method of getting the ID string:

1 - Go to youTube and pick out the video that you want to stream through video.Maru.

You will get a URL that looks something like this: http://youtube.com/watch?v=IDstring.

2 - Edit the URL string by removing the word watch? And change the “=” sign to a “/”. Here is an example:

youTube_fix_1

3 - Now browse to that URL and you will get a very long URL and the video you were watching will appear in a large video interface. You need to grab two pieces of that new URL as illustrated below:

4 - The string that you want to give to video.Maru in order to play a video is: youtube=SomeID&t=SomeLongString.

To play the video above would be: youtube=uCsdPszJLNQ&t=OEgsToPDskJK0D5QnoklN-REer7a0Cq2

You can use that in your XML or directly in your videoWindow or in a linkBtn.

Thanks to Abdul Qabiz’s Blog for figuring out the details on how to implement the changes.