h5p resize script issues in Moodle 3.9

Forums: 

Hi all, 

Currently I am experiencing an issue with the h5p resize script in Moodle 3.9. Recently we've moved from 3.4 to 3.9; the issue was already there in 3.4, but in 3.9 it seems to be worse. We embed the h5p activity - using only the H5P plugin - in a Label. Sometimes there are up to 10 h5p iframes loading on a page (in 10 seperate labels) and not all of them resize to the correct height and width. As far as I can see that's because the script sometimes runs before all of the content of the iframes is loaded. I added the script in a slightly changed version to run after loading of the page with a timeout of 10 seconds. This did not seem to make a lot of difference (still randomly not resizing correctly, even though it  Therefor I wrote my own script that sets an 'onload' function on all h5p iframes, to set height and width (again). This seems to resolve most of the issues, but still it happens randomly that an embedded h5p activity is not scaling correctly (scrollbars appear). I've tested with multiple browsers, multiple courses, different types and amount of h5p activities on a course page, etc. A refresh of the page might solve the scaling issue, but this is not a given; for instance an activity that was of the correct width/height before might then end up wrong, whereas another one might be scaled right. As far as I can see there's no pattern. 

I was wondering if you guys have any ideas or suggestions?  

Also, I'm sorry if this issue has already been discussed somewhere else on these forum, but I can't seem to find a search functionality :) 

 

Many thanks in advance for any responses! Kind regards, 

Lola