NFB video player released

logonfbonf In a joint effort, and as previously stated on this very blog, our friends at the NFB and the folks here at Turbulent Media are now making the popular NFB player available for free for anyone seeking to display videos with flash.

The player is available as a compiled swf and is meant for basic video showcasing. You are free to use it on your blogs, twits and any other online video needs.

Source code and examples are available for download directly from the google code repository page nfb-video-player.

This first downloadable BETA package contains complete source code, all the graphical assets and a complete working example of the video player.

This beautiful player holds the Pyro API at its core, and is quite configurable through a series of flashVar parameters. You can easily integrate the player into your blog or website and use the available parameters to your own needs.

It is also the first exemple of a full Pyro integration being officially released, and will, without a doubt, make quite a few people happy, since we’ve been asked for real life working PYRO exemples.

We will be giving some basic support for questions and bug report related to this player through the nfb-video-player google code project.

Pyro now available on google code.

Pyro


LO and behold, Its official, pyro is now on google code.
You will find it all here: PYRO on google

Thats great news, what will I find there ?
Our google code nest contains the following:

  • Version controlled latest pyro updates and documentations (Be in synch with us here, get the latest latest working build).
  • Latest stable releases and docs packaged in zip files.
  • Upcomming wiki with advices and how-to’s
  • Wait a minute, I knew that !
    Yeah yeah we know its not really new is it ? Already a seasoned pyro user aren’t ya, well we just needed to make it official, dont worry, it’s the exact same repository you’ve been retrieving pyro from. No need for you to change nor update your pyro svn location.

    What the heck are you talking about ? What is this Pyro thing ?
    Pyro is a small flash video API we have build. Nothing to brag too much about, but its worth checking out if you deal with video in flash in your line of work.

    Here is a ‘résumé’ of what it does:

  • Progressive, RTMP (and the likes) and middleware induced streaming all united in one API.
  • Loading and progress ratios.
  • Client side bandwidth detection.
  • Resizing and proportion calculations.
  • Auto adjusts buffertime or lets you handle it as you see fit.
  • Manages dual treshold bufferTime strategies and single treshold bufferTime.
  • Dispatches a flock of Pyro events.
  • Regular play, pause, toggle pause , mute, volue, toggle mute, stop, close, width, height methods…. and so on.
  • and more.
  • Spring physics powered 3D camera for Away3D and Papervision

    Spring powered 3D camera demo

    When building flash 3D application it is often necessary to implement complex routines to manage camera movements. Wether it’s a 3rd person follow cam, a first person FPS camera or a more customized movements most of the time it would be desirable for developers to have access to a simple camera that implements a “natural” movement.

    While developing a small racing game internally as a pet project, I came across the need to develop such a camera, one that would allow us to easily tail a moving object in the scene while keeping the right orientation in relation to the subject. Though, that is simple to do by itself, what really makes this camera interesting is that it’s not a “perfect” follow. In order to give a good acceleration effect on turns and in “turbo boost” moments, I wanted a camera that would be a bit late in it’s follow and allow for smooth and more natural feel, something that you see in classic 3D racing games.

    Hence the Spring Camera was born, a camera that works very simply by implementing spring physics between the camera and it’s target. Imagine the camera is linked by a spring to a target, when the target moves in 3D space the spring extends and then “pulls” the camera thus giving a nice natural feel to the movement.

    “One camera to rule them all”

    Here is a sample Away3D code to initialize a spring cam in the View. By default, the spring motion is activated once the target property of the camera is set:

    Ovbiously, there are more options. 3 main parameters are used to control the behavior of the camera:

    Mass - The “weight” of the camera, how difficult it is to pull it.
    Stiffness - How hard the spring is to extend. A high value here is as if the spring was a stick (or fixed lenght)
    Damping - Controls how the spring resists the spring “boingggg” effect. A higher value makes for a smoother ride, lower values and the more boing you’ll get.

    The camera also implements 2 important offset:

    Position offset - Where the camera should be ideally in relation to the target (in model space). For example, if we want the camera to try to be 100 units behind the target, we’ll use a value of Number3D(0,0,-100); Obviously if the target moves fast we won’t stay 100 units behind exactly which is how the effect is created.

    Look offset - Where the camera should look at in relation to the target. By default, the camera look AT the target but you might want to have the camera attempt to look at a different spot. For example, Number3D(-100,0,0) would look 100 units to the left of the target. (all this in target model space).

    And that’s pretty much all there is to it in terms of usage! The camera will automatically set it’s position in relation to the target based on the physics of the spring every frame without any additional code. Now all you need to do is move the target in 3d space and change it’s orientation…the camera will automatically follow.

    All of these parameters, including target can be modified at runtime and will be updated real-time so you can do some pretty funky adjustments in your application code to create specific effect when needed.

    This camera can be used to build a wide variety of cool cameras movements including but not limited to 3rd person camera, 1st person camera, chase cam, as well as all the standard camera parameters. You can even use it for cool transition effects!

    Take a look at the Spring physics powered 3D camera demonstration.

    Download the SpringCam class for Away3D.
    Simply add the class in your Away3D source in the src/away3d/cameras folder.

    Download the SpringCamera3D class for Papervision3D.
    Simply add the class in your PV3D source in the src/org/papervision3d/cameras folder.

    You can also grab the source code to the demonstration (away3d 2.2.1+ required)

    Special thanks go to Kim Reeves for giving me a needed hand in whipping up the demo. Kudos!

    UPDATE: John Lindquist created a short example using the original Focus example for pv3d with source available.

    Hey if you like it or use it in a project, let us know with a comment and subscribe to our RSS feed!

    Pyro : a video player API for Flash

    video player API for flash


    Pyro is the name of the class set we have been using internally at Turbulent to build all the media players for our many corporate web clients. It’s the results of over 10 rewrites and many many revisions.

    “Why build yet another video player?” you ask. Pyro only integrates the core logic of playing video using flash. Yea, sure, you can build your own thing using NetStream/NetConnection, hey , that’s basically what Pyro does and that’s what professionnals do. They do it over and over again. So why waste time with all the same problems like size handling, duration, bandwidth detection, etc? It’s from this question that Pyro was born.

    It bundles all core functionalities of standard flash video players but leaves out defined design aspects to the developers while leveraging a common, simple and direct AS3 API for handling progressive http, proxied http and rtmp (rtmps, etc..) streams.

    So we wrote some code and documented it.
    You can find all the latest versions at our google code repo, right HERE.

    For now this is a first release to see if there is interest in the community of using and contributing to Pyro. We use Pyro in a number of commercial applications and we keep adding and supporting the small but very functionnal codebase.

    Here’s a basic usage example:

    1. Create a Pyro instance, insert width then height as arguments and add your pyro instance to the child list. If you don’t pass it width / height, Pyro will adjust it’s size to the stream you want to play.

    “Do one thing but do it well”

    Pyro is already at the heart of many of web projects that we have produced in the past few years and such is the case of the National Film Board of canada (NFB). The video player we built for the NFB uses Pyro to implement features like closed-captioning and voice over tracks as well as support 3 modes of streaming. You can see it in action on the www.NFB.ca website.

    NFB / ONF player -  built on Pyro

    Here is a dumb list of what the API provides:

    - Support for progressive download (duh)
    - Support for progressive download with time offsets ( for streaming from a specific time offset in a file)
    - Support for RTMP streaming
    - Bandwidth detection
    - Automatic bufferTime adjustment based on client bandwidth
    - Play / Pause / Buffer state management
    - Volume control and mute state
    - Many resizing options including ratio, fixed or auto-detect.
    - Simple queue point integration and support.
    - Duration handling as well as progress ratio
    - Load ratio

    Hey we’re not reinventing the wheel here. Just making a small solid video player API that implements what we keep repeating all the time. We’ve been pretty careful with memory leaks as well, so hopefully the API is not leaking :)

    PATIENCE PLEASE
    Please be indulgent, Pyro is always evolving and is far from beeing perfect. It might be missing features you were desperately hoping for , if that’s the case, we’re DEFINITLY opened to developing them. Drop us a comment!

    Give it a shot , see if it’s useful, and if it is, please let us know!

    Here’s the docs, and source…again.

    Stay tuned for more examples !

    Eric
    pyrosmalllogo1

    MeshMorph Shapes updated: Fix to Cassini


    Marpi from the Papervision channel contacted me regarding a problem with the Cassini shape in our previous post Papervision3D: Quad layer - Shape morphing source . Seems the that vertices and UV coordinates for the shape were not computed correctly. Well I took some time to correct the problem and realign the UV and vertices of the shape so all should be in order now!

    Unfortunately, even the updated code is made using PV3D-Effects branch, which is outdated now! I do believe the code will function correctly using the latest pv3d trunk, though if anyone encounters some problems and that there is some demand I’ll make an official port.

    Download the updated source shapes here.

    The original experiment was also updated.

    Happy peanuts! (cassini)

    -b

    Flash AS3 optimization - Fastest way to copy an array

    Been having an interesting discussion on the papervision3d channel on freenode. (irc.freenode.net #papervision3d) The question asked by a member was: “What’s the fastest way to copy an array in flash as3?” So Tom Richardson and I made some tests for fun and profit (some guys bet a beer and pizza to Tom that a simple for() loop would win the race) so I started to make a small and barebones test. Obviously knowing we were getting the goods ; we set out to prove them wrong!

    We were evaluating some small snippets of code:
    - The basic for loop with push calls
    - The basic while loop
    - ByteArray copying/cloning
    - Optimized for loop
    - slice()
    - concat()

    We took an array of 500000 elements (all random floats) as source and went for a copy, and here are the results!

    List of 500000 elements.
    for() unoptimized: 118ms
    for() key-key optimized: 30ms
    while() key-key optimized: 30ms
    Bytearray copy: 176ms
    Array slice(): 19ms
    Array concat(): 8ms

    The obvious big time winner seems to be using concat()! Less function calls, less evaluations (and hey less code!) Extremely elegant as well :) Billy owes us pizza and beer.

    Interestingly though, I was most surprised by the slowness of the unoptimized for() loop, scoring just over 100ms, compared to 180ms to perform a complete deep copy (bytearray)…that’s pretty poor. I guess developers would really gain some outstanding performance simply by optimizing their for() loops.

    Using concat() also wins over slice() by about 10ms, which I’m not entirely sure why. I guess there might be addition function calls inside the language. Anybody got some insights on this?

    Here is a small snippet demonstrating it and especially proving the copy array isn’t a reference:

    Here is the source of the tests! Please don’t be afraid to kick and whine if something is not right. I’m also very interested in seeing if there would be an even FASTER way!