I’ve been trying to figure this out for awhile now. I’m updating the CHAOS Framework DisplayVideo class and everything works fine in Flash but it doesn’t work at all in Haxe. Maybe I’ve over looked something or did something wrong. Here is what’s in my project.xml file.
<haxedef name="webgl" if="html5" />
<haxedef name="Dcanvas" if="html5" />
I check the way I handle things in the code and it’s not to different from the other examples I’ve seen on this message board.
This is what I use to handle setting up the class
_video = new Video();
_background = Draw.Square(10, 10, 0xFFFFFF);
_connection = new NetConnection();
_connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
_connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
addEventListener(Event.ADDED_TO_STAGE, onStageAdd, false, 0, true);
addChild(_background);
addChild(_video);
Once you call the load method like so:
_videoURL = value;
_autoStart = autoStart;
var isMediaServer : Bool = false;
// Check to see if string is pointing to media server
for (i in 0...protocolList.length)
{
if (Std.string(_videoURL).indexOf(protocolList[i]) != -1)
isMediaServer = true;
}
_callBack = callBack;
// Force video connect after setting url
_connection.connect(((isMediaServer)) ? _videoURL : null);
It sets the connection to null and then the netStatusHandler
method is fired due to an event listener. In HTML5 it the stats message is “connectSuccess” but in Flash its “NetConnection.Connect.Success”. Then I get a black box and a ton of warnings in Chrome.
[.Offscreen-For-WebGL-049CAFB8]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
(index):1 WebGL: too many errors, no more errors will be reported to the console for this context.
Thanks for the help guys, I can’t wait for the input and to get these changes into the CHAOS GitHub.