Search code examples
flashactionscript-3osmf

OSMF AS3/FlashCS5 Error: Type was not found [...]: StageVideoEvent


I am playing around with OSMF and have a problem running even a super simple example.

I am running Flash CS5 on Win7 in VirtualBox on Arch Linux (just saying because I thought that this may have something to do with the underlying stuff). Also I am using OSMF 1.6 Sprint 1.

Anyways I am trying to run this simple example:

package
{
    import flash.display.Sprite;

    import org.osmf.containers.MediaContainer;
    import org.osmf.elements.VideoElement;
    import org.osmf.media.DefaultMediaFactory;
    import org.osmf.media.MediaElement;
    import org.osmf.media.MediaPlayer;
    import org.osmf.media.URLResource;

    public class OPlayer extends Sprite {
        public function OPlayer() {
            var filePath:String = "testvid.flv";        
            var resource:URLResource = new URLResource(filePath);       
            var mediaFactory:DefaultMediaFactory = new DefaultMediaFactory();
            var mediaElement:MediaElement = mediaFactory.createMediaElement(resource);
            var mediaPlayer:MediaPlayer = new MediaPlayer(mediaElement);
            var mediaContainer:MediaContainer = new MediaContainer();
            mediaContainer.addMediaElement(mediaElement);
            addChild(mediaContainer);
        }
    }

}

And unfortunately I keep getting the following compile error:

1046: Type was not found or was not a compile-time constant: StageVideoEvent.

Solution

  • StageVideo was only officially released last week, your version probably hasen't been updated with the new API's.

    This PDF has info on using it with Flex: http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_2_p1_releasenotes.pdf

    I see you are using Flash CS5, you'll need a playerglobal.swc for that, you could try the Flex one, but I don't think it'll work. Look for a Flash CS5 specific one.

    UPDATE

    I did a quick search and it doesn't look like it is available for Flash Professional CS5 yet, just through the Flex compiler.