MOBILE-3213 h5p: Send a resize event instead of a ready event

main
Dani Palou 2019-12-11 11:47:00 +01:00
parent f675a790ea
commit cb4c666cb7
2 changed files with 5 additions and 11 deletions

View File

@ -9,5 +9,5 @@
<core-download-refresh [status]="state" [enabled]="canDownload" [loading]="calculating" [canTrustDownload]="true" (action)="download()"></core-download-refresh>
</div>
</div>
<core-iframe *ngIf="showPackage" [src]="playerSrc" iframeHeight="auto" [allowFullscreen]="true" (loaded)="sendHello($event)"></core-iframe>
<core-iframe *ngIf="showPackage" [src]="playerSrc" iframeHeight="auto" [allowFullscreen]="true" (loaded)="iframeLoaded()"></core-iframe>
<script *ngIf="resizeScript && showPackage" type="text/javascript" [src]="resizeScript"></script>

View File

@ -269,17 +269,11 @@ export class CoreH5PPlayerComponent implements OnInit, OnChanges, OnDestroy {
}
/**
* Send hello to the H5P iframe.
*
* @param iframe The iframe.
* H5P iframe has been loaded.
*/
sendHello(iframe?: HTMLIFrameElement): void {
const ready = {
context: 'h5p',
action: 'ready'
};
iframe.contentWindow.postMessage(ready, '*');
iframeLoaded(): void {
// Send a resize event to the window so H5P package recalculates the size.
window.dispatchEvent(new Event('resize'));
}
/**