SoundManager 2: Basic Video Example

This is a simple example showing how video can be loaded and played by SM2, with Flash 9.0r115+ (codename "MovieStar", AKA Flash 9 update 3.) See related Flash 9 release notes for supported formats.

How it works

This page includes the SoundManager 2 script which starts up ASAP, and assigns a few video-specific parameters. Javascript API calls can then be made to create, load and play certain MPEG4 video files.

Double-click the video to go full-screen.

Direct video link: Source .MP4

Code

soundManager.url = '../../swf/'; // path to directory containing SoundManager2 .SWF file
soundManager.flashVersion = 9;
soundManager.useMovieStar = true;
soundManager.allowFullScreen = true;

soundManager.onload = function() {
  // soundManager.createSound() etc. may now be called
  soundManager.createVideo({
    id:'photos3Demo',
    url:'http://freshly-ground.com/data/video/Yahoo! Photos 3 UI.MP4'
  });
  soundManager.play('photos3Demo');
}

Metadata, displaying the movie and so on

Additionally, an onmetadata() function handler may be assigned which will be called when meta data is available, including video dimensions (width/height). This is useful for setting the dimensions of the SWF, and/or positioning the container.

Note that to "hide" a movie, positioning or CSS visibility should be used; display:none will destroy a flash movie, and will break things. Also, only one movie can be played at a time.