Merge pull request #2205 from dpalou/MOBILE-3213

MOBILE-3213 h5p: Send a resize event instead of a ready event
main
Juan Leyva 2019-12-11 14:05:56 +01:00 committed by GitHub
commit a317925844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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> <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>

View File

@ -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, '*');
} }
/** /**