Hi, I was testing some HTML5 output and playing around with the “-Ddom” option. I didn’t find much info about it and there are some things I would like to know:
What are performance implications while using it instead of the default canvas output?
Is there a way to consider this -Ddom argument on conditional compilation, like having a code block for Ddom and another for canvas?
I usually encourage developers not to base code around defines like #if webgl, as a WebGL project may need to roll back to canvas if WebGL is not supported on the user’s browser.
However, DOM, perhaps, is a bit of an exception to this. Really, it’s about what you’re building. DOM means every Bitmap is an Image or Canvas (depending on whether you edit your BitmapData) on the DOM, instead of blitting to one canvas. If your content does not change often, or depending on what it is, DOM might be MUCH better, or much worse.
Trivia, though, using bitmapData.draw on DOM is similar to using the full canvas renderer, so you can pick-and-choose what you blit, and what is passively rendered on the DOM. It’s an interesting target, suitable for applications and many types of games, but not action-games where every pixel changes each frame.
Interesting… I’m playing around with DOM with some interesting results (and bugs as well). Video playback seems much nicer using DOM than standard canvas, but setting TextField size (width or height) doesn’t seem to work properly.
WebGL is nice too, but I can’t make video work on it : I just get the audio output. I was also wondering if on WebGL we could have the 3D transformations (like rotations and setting the Z axis position) like we have on Flash display…
Could someone make a short list of DisplayObjects and basic properties that don’t appear to work as expected under certain renderer types? (GL, canvas, DOM)
It seems there may be a couple cases we still need to handle here with TextField and Video, thanks
So in flash you use meta.onMetaData + ns.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
but in html5 you use only meta.onPlayStatus = function(meta:Object):Void{} to control the video.
Thank you, @loudo! Using the playstatus works fine to get the info I need on HTML5 I updated the issues file with this info.
Do you know how to set the current playback time on a playing video on HTML5? O Flash we just need to call NetStream.seek(time), but this does’t seem to work on HTML5… As a workaround I hacked openfl.media.Video class, adding:
public function setCurrentTime(value:Int):Void {
if (this.__stream != null) {
__stream.__video.currentTime = value;
}
}