video.Maru
by polyGeek polyGeek logo



 

Displaying the downloadProgress

December 27th, 2007 . by polyGeek

If you would like to provide a visual display of the percentage of the video file that has been downloaded then use the downloadProgress MovieClip. It will be automatically centered placed at the same location as the timeLine and will be stretched to become the same width as the timeLine when the video has completed downloading.Here’s an example of it in action: ( download example FLA )

A few things to know:

  • I would suggest using a rectangle - any width - as the shape inside the downloadProgress MovieClip. It will stretch as much as needed without pixelizing.
  • Don’t use a stroke on the shape. It will deform in the corners and doesn’t look good.
  • The registration point should be x=0 and y = something near 0. You may have to move the shape up or down inside the MovieClip to adjust it’s vertical placement over the timeLine. The video.Maru code will vertically center the downloadProgess bar over the timeLine. Depending on your design it may not end up where you want it.

Performing an action when the video is complete

December 23rd, 2007 . by polyGeek

It’s pretty simple to perform some action when a video completes playing. You use the videoMaruCreationComplete function to set a callback - videoMaru.setOnVideoComplete( fn ) - to some function that you would like to run when your video finishes playing.

Here is a simple example that is fully commented. Hopefully you can follow this template to do what ever you need to do.

Download Example FLA

Here is the code that enables this. You’ll need to look inside the FLA to understand the layer structure and read the comments.

function videoMaruCreationComplete():Void {
videoMaru.setOnVideoComplete( theVideoIsOver );
}
//
function theVideoIsOver():Void {
this._parent._parent.gotoAndStop( "videoOver" );
}


video.Maru 3.5 beta

December 21st, 2007 . by polyGeek

One of the most common requests I’ve had is to make it so that the XML playlists would scroll. We’ll you don’t have to request it any more. Here it is. ( download FLA )

Here’s the gist of how it works. There will be more extensive documentation shortly as I’m still working on a few scrolling features.

  1. Use the linkBTNholder to position your XML playlist.
  2. If there are the following scroll controls: scrollUp, scrollDn, and ScrollThumb, then linkBTNholder will then be used as a mask for the linkBTNs.
  3. The scroll controls will automatically snap to their correct position. Make sure that everything has a registration point in the upper-left corner or they will appear out of place.

That pretty much does it.
The startPlay button has been updated. Now when you use it it will capture a bitmap copy of the first frame of the video and then close the Netstream object so that there is no further download. When the user clicks on the startPlay button the Netstream object will be recreated and download will begin. This is mainly to save bandwidth for those who have long videos on a page that people may not ever watch.

The bitmap copy of the first frame of video is called freezeFrame. There are API getters/setters to read/change it’s width/height and x/y values, and add a callback for when the freezeFrame is created.

Here’s an example of it in action. Not that it looks any different.

The API has gotten a handful of additional hooks: ( remember, all API calls begin with videoMaru. )

  1. closeNetstream() - this closes the Netstream object and halts further download of the stream. It also stops playing the video. When another video is selected a new Netstream object is created automatically.
  2. setVideoComplete( fn:Function ) - has been changed to setOnVideoComplete. That was a mistake on my part that broke with the naming convention of setting callBack functions.
  3. FreezeFrame : getFreezeFrameHeight():Number, getFreezeFrameWidth():Number, getFreezeFrameX():Number, getFreezeFrameY():Number, setFreezeFramePosition( x,y ), setFreezeFrameDimensions( w, h ), setOnFreezeFrameCreated( fn:Function )
  4. getTimePlayed():Number, getTimeRemaining():Number : both of these return a number of seconds.
  5. enableMouseSeeking( boolean ) - if set to true it allows the user to click on the timeline directly to seek in addition to using the playhead to scrub. This can also be enabled without the API by naming the timeline “timeLineSeek”.
  6. setVideoWindowSizeToMeta() - change the videoWindow’s width/height to the values reported in the FLV metaData.
  7. setVideoWindowSizeToStage() - change the videoWindow’s widght/height to the size of the FLA Stage.
  8. setCaptionXML( path/FileName ) - change the source of the captions file. This way you can do multiple languages. The captions being displayed will automatically catch up to the timePlayed in the video.
  9. setTimeFixedWidth( boolean ) - it forces the timeDisplays to show 00:00:00 instead of 0:00:00

There are a few more features to add. When that’s done and I’m satisfied that the bugs have been ironed out I’ll release video.Maru 3.5. That will probably be sometime in early 2008. Pop over to the Suggestions/Bugs page if you want to see what’s on the list.


Opensource License

December 10th, 2007 . by polyGeek

video.Maru is an open source project started by Dan Florio - polyGeek. There have been a huge number of users who have made feature suggestions to add so I consider the entire user community to be a sort of hive-mind program manager. :-)

I applied the MIT License to video.Maru so that others could use this software without any apprehension. Here is the full text of the MIT License:

 

The MIT License

Copyright (c) 2007 polyGeek

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

So what does all that mean? Essentially you are free to use the SWC for anything you wish. It can be used on commercial sites, you can create custom video interfaces that are driven by video.Maru and sell them - as many have already done, all without any fees, future or past, to be paid to anyone. Nor do you need to publish the fact that you are using video.Maru, although I wouldn’t mind if you did.

You are free to download the source code of video.Maru and use that as you wish. However, in that case you must leave the MIT License intact with the additions you make to the code.

I hope this clears up any confusion or apprehension anyone might have with using video.Maru.


Rollover effects for linkBTNs

December 9th, 2007 . by polyGeek

If you would like to create simple rollOver effects for the linkBTNs then just do this:

  • Inside the linkBTN create a MovieClip and give it an instance name of over.

The over MovieClip will play when the user rolls the mouse over the linkBTN. And it will play backwards when the user rolls the mouse off of the linkBTN. This works for linkBTNs that are placed on the stage or created at runtime via XML.

Here’s an example ( download source )

You’ll need the latest version of video.Maru for this to work.