bitmovin-player-ui icon indicating copy to clipboard operation
bitmovin-player-ui copied to clipboard

Iframe target element is not an instance of HTMLElement causing 'no element found' error

Open beersbr opened this issue 6 years ago • 2 comments

In the most recent version player-v8.16.1 (and master) there is an issue when initializing the player with an element that is in an iframe. The dom.js:66 checks that the something instanceof HTMLElement however if the target element is from an iframe something will be of type HTMLElement of the iframes window and not the callers window.

I have resolved this issue in the past by doing something that would result in some code that looks like this:

if (!!something.ownerDocument && something instanceof something.ownerDocument.defaultView.HTMLElement) {...

beersbr avatar Sep 19 '19 00:09 beersbr

Can you provide a simple HTML part of this setup? Not sure if I understood the problem or the right setup for this issue.

stonko1994 avatar Sep 20 '19 06:09 stonko1994

I have the same issue. Here is a rough view of what's going on. The JS can access the player code using

top.window.bitmovin

but it fails to recognize the container provided

<!--  BASE DOCUMENT  -->
<script src="bitmoving-player.js"></script>
<script src="bitmoving-player-ui.js"></script
	
<iframe src="applications-wrapper">
	<div class="applications-list">
		<iframe src="application-01"></iframe>
		<iframe src="application-02"></iframe>
		<iframe src="application-03">
			<div id="player-target"><!--  WANT TO RENDER PLAYER HERE  --></div>
		</iframe>
		<iframe src="application-04"></iframe>
	</div>
</iframe>

thewardgross avatar Jun 15 '20 22:06 thewardgross