forked from EVOgeek/Vmeda.Online
		
	Merge pull request #2205 from dpalou/MOBILE-3213
MOBILE-3213 h5p: Send a resize event instead of a ready event
This commit is contained in:
		
						commit
						a317925844
					
				| @ -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> | ||||
|  | ||||
| @ -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')); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user