Merge pull request #2205 from dpalou/MOBILE-3213
MOBILE-3213 h5p: Send a resize event instead of a ready eventmain
commit
a317925844
|
@ -9,5 +9,5 @@
|
||||||
<core-download-refresh [status]="state" [enabled]="canDownload" [loading]="calculating" [canTrustDownload]="true" (action)="download()"></core-download-refresh>
|
<core-download-refresh [status]="state" [enabled]="canDownload" [loading]="calculating" [canTrustDownload]="true" (action)="download()"></core-download-refresh>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
<script *ngIf="resizeScript && showPackage" type="text/javascript" [src]="resizeScript"></script>
|
||||||
|
|
|
@ -269,17 +269,11 @@ export class CoreH5PPlayerComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send hello to the H5P iframe.
|
* H5P iframe has been loaded.
|
||||||
*
|
|
||||||
* @param iframe The iframe.
|
|
||||||
*/
|
*/
|
||||||
sendHello(iframe?: HTMLIFrameElement): void {
|
iframeLoaded(): void {
|
||||||
const ready = {
|
// Send a resize event to the window so H5P package recalculates the size.
|
||||||
context: 'h5p',
|
window.dispatchEvent(new Event('resize'));
|
||||||
action: 'ready'
|
|
||||||
};
|
|
||||||
|
|
||||||
iframe.contentWindow.postMessage(ready, '*');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue