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 res开发者_运维知识库ource: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.
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.
I've found it to work quite well using FlashDevelop 4 alpha release http://www.flashdevelop.org/downloads/builds/FlashDevelop-4.0.0-R1747.exe alongside the flex sdk http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+Hero
One thing I have found is that it seems the StageVideoAvailabilityEvent isn't implemented, although I may be wrong about that?
Am getting
[Fault] exception, information=VerifyError: Error #1014: Class flash.events::StageVideoAvailabilityEvent could not be found.
When using it and I found the following comment on http://www.adobe.com/devnet/flashplayer/articles/stage_video.html
The "released" version of the reference at
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html also contains StageVideo information, but the released version is slightly different -- notably, the StageVideoAvailabilityEvent is not yet supported.
Flex 4.5.1.21328 playerglobal.swc , just download it, you will get it. i met the same problem, now i got it
精彩评论