-
- This sample application shows how to connect to an OpenTok session, publish a stream, and subscribe to a single stream in an iOS and Android application.
-
Node.js
-
Ionic:
$ npm install -g ionic
-
Xcode
-
Android Studio
-
Clone this repo
-
Change directory to the sample project
-
Run:
$ npm install
-
Add the android plateform.
-
Add Ionic cordova plugin cordova-plugin-android-permission,cordova-plugin-camera,cordova-plugin-media-capture (add in config.xml)
-
Add below User permission in plateform/android/app/src/main/AndroidManifest.xml (if alwready add dont add)
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
- Install native plugin '@opentok/client','@ionic-native/camera','@ionic-native/android-permissions'
npm install @opentok/client
npm install @ionic-native/camera
npm install @ionic-native/android-permissions
- Request the permission for accessiog CAMERA, AUDIO when plateform is ready.
- In the root directory of the sample project, run
ionic serve
.- This is needed to copy over the files to the
www
folder
- This is needed to copy over the files to the
- Next, run
ionic cordova prepare android
. - Open Android Studio.
- Click
Open an existing Android Studio project
. - Navigate to the
platforms/android
subdirectory of this project and select thebuild.gradle
file. - Click run.
Note: If you're using the simulator, you will see a black container for your publisher since the simulator doesn't have a camera.
Add the following to the project's info.plist
file:
<key>NSCameraUsageDescription</key>
<string>The camera is required to publish video</string>
<key>NSMicrophoneUsageDescription</key>
<string>The microphone is required to publish audio</string>
- In the root directory of the sample project, run
ionic serve
.- This is needed to copy over the files to the
www
folder
- This is needed to copy over the files to the
- Next, run
ionic cordova prepare ios
. - Open Xcode.
- Click
Open another project...
- Navigate to the
platforms/ios
subdirectory of this project and selectMyApp.xcodeproj
. - Sign the project.
- Run.