diff --git a/openvidu-ionic/src/app/app.component.ts b/openvidu-ionic/src/app/app.component.ts index 9047a9d9..9193adca 100644 --- a/openvidu-ionic/src/app/app.component.ts +++ b/openvidu-ionic/src/app/app.component.ts @@ -52,22 +52,11 @@ export class AppComponent implements OnDestroy { this.statusBar.styleDefault(); this.splashScreen.hide(); if (this.platform.is('ios') && this.platform.is('cordova')) { - this.initializeAdapterIosRtc(); + cordova.plugins.iosrtc.registerGlobals(); } }); } - initializeAdapterIosRtc() { - console.log('Initializing iosrct'); - cordova.plugins.iosrtc.registerGlobals(); - // load adapter.js (version 4.0.1) - const script2 = document.createElement('script'); - script2.type = 'text/javascript'; - script2.src = 'assets/libs/adapter-4.0.1.js'; - script2.async = false; - document.head.appendChild(script2); - } - @HostListener('window:beforeunload') beforeunloadHandler() { // On window closed leave session diff --git a/openvidu-ionic/src/app/ov-video.component.ts b/openvidu-ionic/src/app/ov-video.component.ts index e2f865a0..1e7d0156 100644 --- a/openvidu-ionic/src/app/ov-video.component.ts +++ b/openvidu-ionic/src/app/ov-video.component.ts @@ -20,11 +20,10 @@ export class OpenViduVideoComponent implements AfterViewInit, OnDestroy { if (this.isIos() && this._streamManager.remote) { this.rotationFunction = () => { // Give the remote video some time to update its dimensions when rotating the device - setTimeout(() => { - this.applyIosIonicVideoAttributes(); - }, 250); + this.applyIosAttributes(); }; (window).addEventListener('orientationchange', this.rotationFunction); + this.applyIosAttributes(); } this.updateVideoView(); } @@ -73,4 +72,10 @@ export class OpenViduVideoComponent implements AfterViewInit, OnDestroy { private isIos(): boolean { return this.platform.is('ios') && this.platform.is('cordova'); } + + private applyIosAttributes(){ + setTimeout(() => { + this.applyIosIonicVideoAttributes(); + }, 250); + } }