openvidu-ionic: Removed iosrtc and updated dependencies
This commit is contained in:
parent
2b63fd1cf4
commit
507f40e7c7
@ -117,7 +117,7 @@
|
||||
}
|
||||
},
|
||||
"ionic-cordova-build": {
|
||||
"builder": "@ionic/angular-toolkit:cordova-build",
|
||||
"builder": "@ionic/cordova-builders:cordova-build",
|
||||
"options": {
|
||||
"browserTarget": "app:build"
|
||||
},
|
||||
@ -128,7 +128,7 @@
|
||||
}
|
||||
},
|
||||
"ionic-cordova-serve": {
|
||||
"builder": "@ionic/angular-toolkit:cordova-serve",
|
||||
"builder": "@ionic/cordova-builders:cordova-serve",
|
||||
"options": {
|
||||
"cordovaBuildTarget": "app:ionic-cordova-build",
|
||||
"devServerTarget": "app:serve"
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
<preference name="SplashShowOnlyFirstTime" value="false" />
|
||||
<preference name="SplashScreen" value="screen" />
|
||||
<preference name="SplashScreenDelay" value="3000" />
|
||||
<preference name="WKWebViewOnly" value="true" />
|
||||
<preference name="AllowInlineMediaPlayback" value="true" />
|
||||
<platform name="android">
|
||||
<allow-intent href="market:*" />
|
||||
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
|
||||
@ -48,7 +50,6 @@
|
||||
<platform name="ios">
|
||||
<allow-intent href="itms:*" />
|
||||
<allow-intent href="itms-apps:*" />
|
||||
<hook src="hooks/iosrtc-swift-support.js" type="after_platform_add" />
|
||||
<config-file parent="NSCameraUsageDescription" target="*-Info.plist">
|
||||
<string>OpenVidu needs access to your camera</string>
|
||||
</config-file>
|
||||
@ -115,6 +116,5 @@
|
||||
<plugin name="cordova-plugin-ionic-webview" spec="2.0.0" />
|
||||
<plugin name="cordova-plugin-ionic-keyboard" spec="2.0.5" />
|
||||
<plugin name="cordova-plugin-android-permissions" spec="1.0.0" />
|
||||
<engine name="browser" spec="6.0.0" />
|
||||
<engine name="android" spec="7.0.0" />
|
||||
</widget>
|
||||
|
||||
@ -1,143 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
// This hook automates this:
|
||||
// https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc/blob/master/docs/Building.md
|
||||
|
||||
var
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
xcode = require('xcode'),
|
||||
|
||||
BUILD_VERSION = '11.0',
|
||||
BUILD_VERSION_XCODE = '"' + BUILD_VERSION + '"',
|
||||
SWIFT_VERSION = '4.2',
|
||||
SWIFT_VERSION_XCODE = '"' + SWIFT_VERSION + '"',
|
||||
RUNPATH_SEARCH_PATHS = '@executable_path/Frameworks',
|
||||
RUNPATH_SEARCH_PATHS_XCODE = '"' + RUNPATH_SEARCH_PATHS + '"',
|
||||
ENABLE_BITCODE = 'NO',
|
||||
ENABLE_BITCODE_XCODE = '"' + ENABLE_BITCODE + '"',
|
||||
BRIDGING_HEADER_END = '/Plugins/cordova-plugin-iosrtc/cordova-plugin-iosrtc-Bridging-Header.h',
|
||||
COMMENT_KEY = /_comment$/;
|
||||
|
||||
|
||||
// Helpers
|
||||
|
||||
// Returns the project name
|
||||
function getProjectName(protoPath) {
|
||||
var
|
||||
cordovaConfigPath = path.join(protoPath, 'config.xml'),
|
||||
content = fs.readFileSync(cordovaConfigPath, 'utf-8');
|
||||
|
||||
return /<name>([\s\S]*)<\/name>/mi.exec(content)[1].trim();
|
||||
}
|
||||
|
||||
// Drops the comments
|
||||
function nonComments(obj) {
|
||||
var
|
||||
keys = Object.keys(obj),
|
||||
newObj = {},
|
||||
i = 0;
|
||||
|
||||
for (i; i < keys.length; i += 1) {
|
||||
if (!COMMENT_KEY.test(keys[i])) {
|
||||
newObj[keys[i]] = obj[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
|
||||
// Starting here
|
||||
|
||||
module.exports = function (context) {
|
||||
var
|
||||
projectRoot = context.opts.projectRoot,
|
||||
projectName = getProjectName(projectRoot),
|
||||
xcconfigPath = path.join(projectRoot, '/platforms/ios/cordova/build.xcconfig'),
|
||||
xcodeProjectName = projectName + '.xcodeproj',
|
||||
xcodeProjectPath = path.join(projectRoot, 'platforms', 'ios', xcodeProjectName, 'project.pbxproj'),
|
||||
swiftBridgingHead = projectName + BRIDGING_HEADER_END,
|
||||
swiftBridgingHeadXcode = '"' + swiftBridgingHead + '"',
|
||||
swiftOptions = [''], // <-- begin to file appending AFTER initial newline
|
||||
xcodeProject;
|
||||
|
||||
// Checking if the project files are in the right place
|
||||
if (!fs.existsSync(xcodeProjectPath)) {
|
||||
debugerror('an error occurred searching the project file at: "' + xcodeProjectPath + '"');
|
||||
|
||||
return;
|
||||
}
|
||||
debug('".pbxproj" project file found: ' + xcodeProjectPath);
|
||||
|
||||
if (!fs.existsSync(xcconfigPath)) {
|
||||
debugerror('an error occurred searching the project file at: "' + xcconfigPath + '"');
|
||||
|
||||
return;
|
||||
}
|
||||
debug('".xcconfig" project file found: ' + xcconfigPath);
|
||||
|
||||
xcodeProject = xcode.project(xcodeProjectPath);
|
||||
|
||||
// Showing info about the tasks to do
|
||||
debug('fixing issues in the generated project files:');
|
||||
debug('- "iOS Deployment Target" and "Deployment Target" to: ' + BUILD_VERSION_XCODE);
|
||||
debug('- "Runpath Search Paths" to: ' + RUNPATH_SEARCH_PATHS_XCODE);
|
||||
debug('- "Objective-C Bridging Header" to: ' + swiftBridgingHeadXcode);
|
||||
debug('- "ENABLE_BITCODE" set to: ' + ENABLE_BITCODE_XCODE);
|
||||
debug('- "SWIFT_VERSION" set to: ' + SWIFT_VERSION_XCODE);
|
||||
|
||||
|
||||
// Massaging the files
|
||||
|
||||
// "build.xcconfig"
|
||||
swiftOptions.push('LD_RUNPATH_SEARCH_PATHS = ' + RUNPATH_SEARCH_PATHS);
|
||||
swiftOptions.push('SWIFT_OBJC_BRIDGING_HEADER = ' + swiftBridgingHead);
|
||||
swiftOptions.push('IPHONEOS_DEPLOYMENT_TARGET = ' + BUILD_VERSION);
|
||||
swiftOptions.push('ENABLE_BITCODE = ' + ENABLE_BITCODE);
|
||||
swiftOptions.push('SWIFT_VERSION = ' + SWIFT_VERSION);
|
||||
// NOTE: Not needed
|
||||
// swiftOptions.push('EMBEDDED_CONTENT_CONTAINS_SWIFT = YES');
|
||||
fs.appendFileSync(xcconfigPath, swiftOptions.join('\n'));
|
||||
debug('file correctly fixed: ' + xcconfigPath);
|
||||
|
||||
// "project.pbxproj"
|
||||
// Parsing it
|
||||
xcodeProject.parse(function (error) {
|
||||
var configurations, buildSettings;
|
||||
|
||||
if (error) {
|
||||
debugerror('an error occurred during the parsing of the project file');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection());
|
||||
// Adding or changing the parameters we need
|
||||
Object.keys(configurations).forEach(function (config) {
|
||||
buildSettings = configurations[config].buildSettings;
|
||||
buildSettings.LD_RUNPATH_SEARCH_PATHS = RUNPATH_SEARCH_PATHS_XCODE;
|
||||
buildSettings.SWIFT_OBJC_BRIDGING_HEADER = swiftBridgingHeadXcode;
|
||||
buildSettings.IPHONEOS_DEPLOYMENT_TARGET = BUILD_VERSION_XCODE;
|
||||
buildSettings.ENABLE_BITCODE = ENABLE_BITCODE_XCODE;
|
||||
buildSettings.SWIFT_VERSION = SWIFT_VERSION_XCODE;
|
||||
});
|
||||
|
||||
// Writing the file again
|
||||
fs.writeFileSync(xcodeProjectPath, xcodeProject.writeSync(), 'utf-8');
|
||||
debug('file correctly fixed: ' + xcodeProjectPath);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function debug(msg) {
|
||||
console.log('iosrtc-swift-support.js [INFO] ' + msg);
|
||||
}
|
||||
|
||||
|
||||
function debugerror(msg) {
|
||||
console.error('iosrtc-swift-support.js [ERROR] ' + msg);
|
||||
}
|
||||
28433
openvidu-ionic/package-lock.json
generated
28433
openvidu-ionic/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -13,50 +13,47 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/common": "13.1.3",
|
||||
"@angular/core": "13.1.3",
|
||||
"@angular/forms": "13.1.3",
|
||||
"@angular/platform-browser": "13.1.3",
|
||||
"@angular/platform-browser-dynamic": "13.1.3",
|
||||
"@angular/router": "13.1.3",
|
||||
"@angular/common": "14.0.3",
|
||||
"@angular/core": "14.0.3",
|
||||
"@angular/forms": "14.0.3",
|
||||
"@angular/platform-browser": "14.0.3",
|
||||
"@angular/platform-browser-dynamic": "14.0.3",
|
||||
"@angular/router": "14.0.3",
|
||||
"@ionic-native/android-permissions": "5.36.0",
|
||||
"@ionic-native/core": "5.36.0",
|
||||
"@ionic-native/splash-screen": "5.36.0",
|
||||
"@ionic-native/status-bar": "5.36.0",
|
||||
"@ionic/angular": "6.0.3",
|
||||
"@ionic/angular": "6.1.11",
|
||||
"@ionic/cordova-builders": "^6.1.0",
|
||||
"compare-func": "2.0.0",
|
||||
"cordova-android": "10.1.1",
|
||||
"cordova-browser": "6.0.0",
|
||||
"cordova-android": "10.1.2",
|
||||
"cordova-ios": "6.2.0",
|
||||
"cordova-plugin-android-permissions": "1.1.3",
|
||||
"cordova-plugin-device": "2.0.3",
|
||||
"cordova-plugin-device": "2.1.0",
|
||||
"cordova-plugin-ionic-keyboard": "2.2.0",
|
||||
"cordova-plugin-ionic-webview": "5.0.0",
|
||||
"cordova-plugin-iosrtc": "6.0.21",
|
||||
"cordova-plugin-splashscreen": "6.0.0",
|
||||
"cordova-plugin-splashscreen": "6.0.1",
|
||||
"cordova-plugin-statusbar": "3.0.0",
|
||||
"core-js": "3.20.3",
|
||||
"openvidu-browser": "2.20.0",
|
||||
"rxjs": "6.6.7",
|
||||
"core-js": "3.23.3",
|
||||
"openvidu-browser": "2.22.0",
|
||||
"rxjs": "7.5.5",
|
||||
"xcode": "3.0.1",
|
||||
"zone.js": "0.11.4"
|
||||
"zone.js": "0.11.6"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"ios-deploy": "1.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/architect": "0.1301.4",
|
||||
"@angular-devkit/build-angular": "13.1.3",
|
||||
"@angular-devkit/core": "13.1.3",
|
||||
"@angular-devkit/schematics": "13.1.3",
|
||||
"@angular-eslint/eslint-plugin": "13.0.1",
|
||||
"@angular/cli": "13.1.3",
|
||||
"@angular/compiler": "13.1.3",
|
||||
"@angular/compiler-cli": "13.1.3",
|
||||
"@angular/language-service": "13.1.3",
|
||||
"@ionic/angular-toolkit": "5.0.3",
|
||||
"@types/jasmine": "3.10.3",
|
||||
"@types/jasminewd2": "2.0.10",
|
||||
"@angular-devkit/architect": "0.1400.3",
|
||||
"@angular-devkit/build-angular": "14.0.3",
|
||||
"@angular-devkit/core": "14.0.3",
|
||||
"@angular-devkit/schematics": "14.0.3",
|
||||
"@angular-eslint/eslint-plugin": "14.0.0",
|
||||
"@angular/cli": "14.0.3",
|
||||
"@angular/compiler": "14.0.3",
|
||||
"@angular/compiler-cli": "14.0.3",
|
||||
"@angular/language-service": "14.0.3",
|
||||
"@ionic/angular-toolkit": "^6.1.0",
|
||||
"@types/node": "17.0.10",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
||||
"@typescript-eslint/parser": "^4.28.2",
|
||||
@ -64,17 +61,9 @@
|
||||
"eslint": "^7.30.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"jasmine-core": "3.8.0",
|
||||
"jasmine-spec-reporter": "7.0.0",
|
||||
"karma": "6.3.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage-istanbul-reporter": "3.0.3",
|
||||
"karma-jasmine": "4.0.1",
|
||||
"karma-jasmine-html-reporter": "1.6.0",
|
||||
"protractor": "7.0.0",
|
||||
"ts-node": "10.0.0",
|
||||
"tslib": "2.3.1",
|
||||
"typescript": "4.4.4"
|
||||
"typescript": "4.6.2"
|
||||
},
|
||||
"description": "An Ionic project",
|
||||
"cordova": {
|
||||
@ -86,13 +75,9 @@
|
||||
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
|
||||
},
|
||||
"cordova-plugin-ionic-keyboard": {},
|
||||
"cordova-plugin-android-permissions": {},
|
||||
"cordova-plugin-iosrtc": {
|
||||
"MANUAL_INIT_AUDIO_DEVICE": "FALSE"
|
||||
}
|
||||
"cordova-plugin-android-permissions": {}
|
||||
},
|
||||
"platforms": [
|
||||
"browser",
|
||||
"android",
|
||||
"ios"
|
||||
]
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
</ion-content>
|
||||
|
||||
<ion-content [scrollEvents]="true" (ionScroll)="refreshVideos()" *ngIf="session">
|
||||
<ion-content *ngIf="session">
|
||||
<div id="session-header">
|
||||
<h1 id="session-title">{{mySessionId}}</h1>
|
||||
</div>
|
||||
|
||||
@ -7,7 +7,6 @@ import { Platform, AlertController } from '@ionic/angular';
|
||||
import { OpenVidu, Publisher, Session, StreamEvent, StreamManager, Subscriber } from 'openvidu-browser';
|
||||
import { throwError as observableThrowError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
declare var cordova;
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -49,11 +48,8 @@ export class AppComponent implements OnDestroy {
|
||||
|
||||
initializeApp() {
|
||||
this.platform.ready().then(() => {
|
||||
this.statusBar.styleDefault();
|
||||
this.statusBar.overlaysWebView(false);
|
||||
this.splashScreen.hide();
|
||||
if (this.platform.is('ios') && this.platform.is('cordova')) {
|
||||
cordova.plugins.iosrtc.registerGlobals();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -167,12 +163,6 @@ export class AppComponent implements OnDestroy {
|
||||
this.generateParticipantInfo();
|
||||
}
|
||||
|
||||
refreshVideos() {
|
||||
if (this.platform.is('ios') && this.platform.is('cordova')) {
|
||||
cordova.plugins.iosrtc.refreshVideos();
|
||||
}
|
||||
}
|
||||
|
||||
private checkAndroidPermissions(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
@ -1,81 +1,35 @@
|
||||
import { AfterViewInit, Component, ElementRef, Input, ViewChild, OnDestroy } from '@angular/core';
|
||||
import { StreamManager, StreamPropertyChangedEvent } from 'openvidu-browser';
|
||||
import { Platform } from '@ionic/angular';
|
||||
declare var cordova;
|
||||
import {
|
||||
AfterViewInit,
|
||||
Component,
|
||||
ElementRef,
|
||||
Input,
|
||||
ViewChild,
|
||||
} from "@angular/core";
|
||||
import { StreamManager } from "openvidu-browser";
|
||||
|
||||
@Component({
|
||||
selector: 'ov-video',
|
||||
template: '<video #videoElement style="width: 100%"></video>'
|
||||
selector: "ov-video",
|
||||
template: '<video #videoElement style="width: 100%"></video>',
|
||||
})
|
||||
export class OpenViduVideoComponent implements AfterViewInit, OnDestroy {
|
||||
export class OpenViduVideoComponent implements AfterViewInit {
|
||||
@ViewChild("videoElement") elementRef: ElementRef;
|
||||
_streamManager: StreamManager;
|
||||
|
||||
@ViewChild('videoElement') elementRef: ElementRef;
|
||||
_streamManager: StreamManager;
|
||||
constructor() {}
|
||||
|
||||
rotationFunction;
|
||||
ngAfterViewInit() {
|
||||
this.updateVideoView();
|
||||
}
|
||||
|
||||
constructor(private platform: Platform) {}
|
||||
@Input()
|
||||
set streamManager(streamManager: StreamManager) {
|
||||
this._streamManager = streamManager;
|
||||
this.updateVideoView();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (this.isIos() && this._streamManager.remote) {
|
||||
this.rotationFunction = () => {
|
||||
// Give the remote video some time to update its dimensions when rotating the device
|
||||
this.applyIosAttributes();
|
||||
};
|
||||
(<any>window).addEventListener('orientationchange', this.rotationFunction);
|
||||
this.applyIosAttributes();
|
||||
}
|
||||
this.updateVideoView();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (!!this.rotationFunction) {
|
||||
(<any>window).removeEventListener('orientationchange', this.rotationFunction);
|
||||
}
|
||||
}
|
||||
|
||||
@Input()
|
||||
set streamManager(streamManager: StreamManager) {
|
||||
this._streamManager = streamManager;
|
||||
if (this.isIos()) {
|
||||
this._streamManager.on('streamPropertyChanged', event => {
|
||||
if ((<StreamPropertyChangedEvent>event).changedProperty === 'videoDimensions') {
|
||||
this.applyIosIonicVideoAttributes();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private updateVideoView() {
|
||||
this._streamManager.addVideoElement(this.elementRef.nativeElement);
|
||||
if (this.isIos()) {
|
||||
(<HTMLVideoElement>this.elementRef.nativeElement).onloadedmetadata = () => {
|
||||
this.applyIosIonicVideoAttributes();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private applyIosIonicVideoAttributes() {
|
||||
const ratio = this._streamManager.stream.videoDimensions.height / this._streamManager.stream.videoDimensions.width;
|
||||
this.elementRef.nativeElement.style.width = '100% !important';
|
||||
this.elementRef.nativeElement.style.objectFit = 'fill';
|
||||
this.elementRef.nativeElement.style.zIndex = '-1';
|
||||
const computedWidth = this.elementRef.nativeElement.offsetWidth;
|
||||
this.elementRef.nativeElement.style.height = computedWidth * ratio + 'px';
|
||||
if (!this._streamManager.remote) {
|
||||
// It is a Publisher video. Custom iosrtc plugin mirror video
|
||||
this.elementRef.nativeElement.style.transform = 'scaleX(-1)';
|
||||
}
|
||||
cordova.plugins.iosrtc.refreshVideos();
|
||||
}
|
||||
|
||||
private isIos(): boolean {
|
||||
return this.platform.is('ios') && this.platform.is('cordova');
|
||||
}
|
||||
|
||||
private applyIosAttributes(){
|
||||
setTimeout(() => {
|
||||
this.applyIosIonicVideoAttributes();
|
||||
}, 250);
|
||||
}
|
||||
private updateVideoView() {
|
||||
if (!!this.elementRef) {
|
||||
this._streamManager.addVideoElement(this.elementRef.nativeElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,10 +10,6 @@
|
||||
@import "~@ionic/angular/css/text-transformation.css";
|
||||
@import "~@ionic/angular/css/flex-utils.css";
|
||||
|
||||
:root {
|
||||
--ion-background-color: transparent;
|
||||
}
|
||||
|
||||
.alert-wrapper{
|
||||
--background: #ffffff !important;
|
||||
}
|
||||
@ -15,7 +15,7 @@
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es5",
|
||||
"target": "ES2015",
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user