Giter Site home page Giter Site logo

apirtc-mobile's Introduction

ApiRTC on Cordova

This tutorial explains you how to use apiRTC and to build an application for iOS and android.

First of all you need to install Cordova. Please follow this link to get started with cordova

To build this example, you first need to add a target platform and a few plugins

git clone https://github.com/apizee/ApiRTC-mobile.git
cordova plugin add cordova-plugin-console
cordova plugin add cordova-custom-config
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-iosrtc
cordova plugin add cordova-plugin-media
cordova plugin add android-camera-permission
cordova plugin add [email protected]
cordova platform add ios
cordova platform add android

Then, run an emulator like this :

cordova build ios
cordova run ios

cordova build android
cordova run android --device

Open this link with Chrome to exchange with your mobile over webrtc

Requirements

In order to make this application run into a iOS application some requirements must be satisfied in both development computer and target devices:

  • Xcode >= 7.2.1
  • iOS >= 10.2 (run on lower versions at your own risk, but don't report issues)
  • cordova-ios 4.X

ApiRTC key

For this demo we use the Api key "myDemoApiKey". Please register on our website to get your private api key.

Building errors on iOS

To avoid errors, we use the plugin cordova-custom-config to integrate all Xcode configuration. But you can find solutions here:

Build error

Swift is unavailable on iOS versions under 7.0. Please set IPHONEOS_DEPLOYMENT_TARGET to 7.0 or later (currently it is ‘6.0’).

Solution

Click on your project files tree in XCode on HelloCordova Go to Build Settings, look under Deployment Info, change iOS Deployment Target to 7.0

Build error

"Use of undeclared identifier” and “Use of undeclared type"

Solution

Go to Build Settings, look under “Swift Compiler – Code Generation” (near the bottom), edit the setting “Objective-C Bridging Header” and enter ../../plugins/cordova-plugin-iosrtc/src/cordova-plugin-iosrtc-Bridging-Header.h in debug and release

Build error

You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution

Go to Build Settings, Build Option, edit the setting “Enable bitcode” to “NO”

Runtime error

Thread 1: EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)” Meanwhile, the output console shows: dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /private/var/mobile/Containers/Bundle/Application/XX/WebRTCSample.app/WebRTCSample Reason: image not found

Solution

Go to Build Settings, look under Linking, edit “Runpath Search Paths”, and add the path @executable_path/Frameworks in debug and release

##Building errors on Android **Add the following permissions to the Android manifest **:(/platforms/android/AndroidManifest.xml).

Update your project Run the command

cordova prepare

Build your project

cordova run android

##Optional tips

The crosswalk plugin is not necessary for Android 5.0+ as WebRTC is now supported in native WebView. It may enable you to have lightweight application but you will loose compatibility with Android version less than 5.0

The following steps will convert the project to use Android 5.0+ native WebView.

-If crosswalk plugin is already added, remove it with Terminal command : cordova plugin remove cordova-plugin-crosswalk-webview -In AndroidManifest.xml, set the minSdkVersion to 21. -A patch may be needed in Cordova to allow WebRTC getUserMedia. Refer to pull request https://github.com/apache/cordova-android/pull/178/files to make changes to the file /platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebChromeClient.java.

##Try your project

In order to test, open this link on your computer browser:

You will be able to establish a webRTC call between your app and your computer using the number that has been automatically assigned to your apiRTC Client.

apirtc-mobile's People

Contributors

sliard avatar fredluart avatar la-pulga avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.