[OpenFL 9.1.0 , HTML5] Video error: no texture bound to target

Hello,

I’ve switched from older to newer version of haxe/openfl:
haxe 3.2.1 -> 4.2.1
openfl 8.6.4 -> 9.1.0
lime 7.1.1 -> 7.9.0

and suddenly all of the videos in my applications stopped working.

I use classes: Video, NetStream, NetConnection (html5 target, WebGL)

On my_net_stream.play() I receive the following error:

WebGL: INVALID_OPERATION: texParameter: no texture bound to target

Context3DVideo.hx:73 WebGL: INVALID_OPERATION: texParameter: no texture bound to target

[.WebGL-06AD8828]RENDER WARNING: texture bound to texture unit 0 is not renderable. It might be non-power-of-2 or have incompatible texture filtering (maybe)?

Does anyone have similar problem? Please share your experience. I would be glad for any clues, since I have no idea where to start searching for the problem.

So basically I’m fu… up. I have to get back to Haxe 3.

If anyone wonders why haxe is not popular among developers, here you have.

Hi Klinek,

Why do you want to stay with haxe 3 ?

Logically the problem should me more with openfl ( or lime).

I would try try
haxe 4.2.1
openfl 8.9.7
lime 7.9.0
to see it works

If it works it means is the openfl which causes problems ( changing major version is always with risks)

I’ve already checked all the openfl versions that are compatible with Haxe 4.X.
The problem still remains.

The following lines from Context3DVideo.hx throw up the error:
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);

I also noticed that there in no clear confirmation on OpenFl and Haxe forum that anyone actually managed to play web video with the use of Haxe 4.

My assumption for now is that it’s not possible at the moment. That’s disappointing, since I can see significant performance improvement and would rather not get back to Haxe 3.

In case someone knows any workaround, please share your solution / thoughts.

PS: what’s more, there is also this problem:
(I’ve tried different ideas for this one as well, but without success. It seems like a bug within VideoElement)

I have no problem playing videos on Haxe 4.2.1… But OpenFL is modified 8.9.1 version. So haxe can hardly be a problem. Unless you’re talking about specific devices, which I have not tested.

Hey,
although it is possible to play videos I often ran into major problems regarding platforms, browsers resulting strange behaviors etc.
A workaround which pretty much fits my needs is to simply create an overlay with an iFrame.

You just need to modify the OpenFl index.html template by copying it to a template folder (also add <template path="Assets/templates"/> to your project.xml), link to a JS file
<script type="text/javascript" src="customs.js"></script>
(which contains two functions to create an iFrame and to remove it),
a css file also helps
<link rel="stylesheet" href="customs.css">
and add a div container above the openfl-content, like
<div id="additional-content"></div>.

In our case we decided just to show YT-videos, so the JS functions look like that:

function createVideoIFrame(_url) {
 var additionalContents = document.getElementById("additional-content");
 additionalContents.style.visibility = "visible";
 var iframe = document.createElement('iframe');";
 iframe.setAttribute("src", _url);
 iframe.id = "yFrame";
 iframe.style.zIndex = "20";
 iframe.style.border = 0;
 additionalContents.appendChild(iframe);
}


function killVideoIFrame() {
  var opCont = document.getElementById("openfl-content");
  opCont.iFrameCallback("Browser Callback: Kill Video IFrame");
  var additionalContents = document.getElementById("additional-content");
  var iframe = document.getElementById("yFrame");
  if (iframe != undefined) {
    additionalContents.removeChild(iframe);
    iframe = null;
  } else {
    alert("There was an error removing the iframe");
  }
  additionalContents.style.visibility = "hidden";
 }

Now all you have to do in your OpenFl code is simply call the open or close function by.

if (ExternalInterface.available) {
		ExternalInterface.call("createVideoIFrame", _url);
	}


if (ExternalInterface.available) {
				ExternalInterface.call("killVideoIFrame");
			} 

Hope that helps…?

1 Like

Thank you ‘Beckwahn’. Your solution is very interesting. I will definitely adopt it.

And those who have enough of the openfl/haxe version mess, I encourage to switch to external java script library for video player, with the use of ExternalInterface. There are multiple libraries on the market. None of them is 100% perfect (usually miss some options in API), but at least you can be sure they work for now and will work in the future.

1 Like