jiti-meet/ios
Paweł Domas f8294fb312 android: add ConnectionService
* feat(Android): implement ConnectionService

Adds basic integration with Android's ConnectionService by implementing
the outgoing call scenario.

* ref(callkit): rename _SET_CALLKIT_SUBSCRIPTIONS

* ref(callkit): move feature to call-integration directory

* feat(ConnectionService): synchronize video state

* ref(AudioMode): use ConnectionService on API >= 26

Not ready yet - few details left mentioned in the FIXMEs

* feat(ConnectionService): add debug logs

Adds logs to trace the calls.

* fix(ConnectionService): leaking ConnectionImpl instances

Turns out there is no callback fired back from the JavaScript side after
the disconnect or abort event is sent from the native. The connection
must be marked as disconnected and removed immediately.

* feat(ConnectionService): handle onCreateOutgoingConnectionFailed

* ref(ConnectionService): merge classes and move to the sdk package

* feat(CallIntegration): show Alert if outgoing call fails

* fix(ConnectionService): alternatively get call UUID from the account

Some Android flavours (or versions ?) do copy over extras to
the onCreateOutgoingConnectionFailed callback. But the call UUID is also
set as the PhoneAccount's label, so eventually it should be available
there.

* ref(ConnectionService): use call UUID as PhoneAccount ID.

The extra is not reliable on some custom Android flavours. It also makes
sense to use unique id for the account instead of the URL given that
it's created on the per call basis.

* fix(ConnectionService): abort the call when hold is requested

Turns out Android P can sometimes request HOLD even though there's no
HOLD capability added to the connection (what!?), so just abort the call
in that case.

* fix(ConnectionService): unregister account on call failure

Unregister the PhoneAccount onCreateOutgoingConnectionFailed. That's
before the ConnectionImpl instance is created which is normally
responsible for doing that.

* fix(AudioModeModule): make package private and run on the audio thread

* address other review comments
2019-01-31 17:20:53 +01:00
..
app rn: set version to 19.0.0 2019-01-29 17:25:00 +01:00
example-pip-app ios: drop iOS 9 support 2018-12-06 10:47:44 +01:00
fastlane ios: add initial Fastlane integration 2019-01-16 11:01:42 +01:00
jitsi-meet.xcworkspace ios: switch back to the "legacy" build system in Xcode 2018-12-04 12:12:01 +01:00
scripts deps: update React Native to version 0.57 2018-10-10 18:07:36 +02:00
sdk android: add ConnectionService 2019-01-31 17:20:53 +01:00
travis-ci fix(Travis/iOS): use '-quiet' with 'xcodebuild' commands 2018-09-24 14:34:11 -05:00
Podfile rn: add Firebase integration 2019-01-08 17:42:59 +01:00
Podfile.lock chore(ios): update Podfile.lock 2019-01-23 17:04:41 +01:00
README.md ios: update SDK installation instructions 2019-01-08 09:41:27 +01:00
apple-app-site-association [iOS] Prepare for App Store release 2016-11-13 18:45:40 -06:00

README.md

Jitsi Meet SDK for iOS

The Jitsi Meet iOS SDK provides the same user experience as the Jitsi Meet app, in a customizable way which you can embed in your apps.

Usage

There are 2 ways to integrate the SDK into your project:

  • Using CocoaPods
  • Building it yourself

Using CocoaPods

Follow the instructions here.

Builduing it yourself

  1. Install all required dependencies.

  2. xcodebuild -workspace ios/jitsi-meet.xcworkspace -scheme JitsiMeet -destination='generic/platform=iOS' -configuration Release archive

After successfully building Jitsi Meet SDK for iOS, copy ios/sdk/JitsiMeet.framework (if the path points to a symbolic link, follow the symbolic link) and node_modules/react-native-webrtc/ios/WebRTC.framework into your project.

API

JitsiMeet is an iOS framework which embodies the whole Jitsi Meet experience and makes it reusable by third-party apps.

To get started:

  1. Add a JitsiMeetView to your app using a Storyboard or Interface Builder, for example.

  2. Then, once the view has loaded, set the delegate in your controller and load the desired URL:

- (void)viewDidLoad {
  [super viewDidLoad];

  JitsiMeetView *jitsiMeetView = (JitsiMeetView *) self.view;

  jitsiMeetView.delegate = self;
  [jitsiMeetView loadURL:nil];
}

JitsiMeetView class

The JitsiMeetView class is the entry point to the SDK. It a subclass of UIView which renders a full conference in the designated area.

delegate

Property to get/set the JitsiMeetViewDelegate on JitsiMeetView.

defaultURL

Property to get/set the default base URL used to join a conference when a partial URL (e.g. a room name only) is specified to loadURLString:/loadURLObject:. If not set or if set to nil, the default built in JavaScript is used: https://meet.jit.si.

NOTE: Must be set (if at all) before loadURL:/loadURLString: for it to take effect.

pictureInPictureEnabled

Property to get / set whether Picture-in-Picture is enabled. Defaults to YES if delegate implements enterPictureInPicture:; otherwise, NO.

NOTE: Must be set (if at all) before loadURL:/loadURLString: for it to take effect.

welcomePageEnabled

Property to get/set whether the Welcome page is enabled. If NO, a black empty view will be rendered when not in a conference. Defaults to NO.

NOTE: Must be set (if at all) before loadURL:/loadURLString: for it to take effect.

loadURL:NSURL

[jitsiMeetView loadURL:[NSURL URLWithString:@"https://meet.jit.si/test123"]];

Loads a specific URL which may identify a conference to join. If the specified URL is nil and the Welcome page is enabled, the Welcome page is displayed instead.

loadURLObject:NSDictionary

[jitsiMeetView loadURLObject:@{
    @"config": @{
        @"startWithAudioMuted": @YES,
        @"startWithVideoMuted": @NO
    },
    @"url": @"https://meet.jit.si/test123"
}];

Loads a specific URL which may identify a conference to join. The URL is specified in the form of an NSDictionary of properties which (1) internally are sufficient to construct a URL (string) while (2) abstracting the specifics of constructing the URL away from API clients/consumers. If the specified URL is nil and the Welcome page is enabled, the Welcome page is displayed instead.

loadURLString:NSString

[jitsiMeetView loadURLString:@"https://meet.jit.si/test123"];

Loads a specific URL which may identify a conference to join. If the specified URL is nil and the Welcome page is enabled, the Welcome page is displayed instead.

Universal / deep linking

In order to support Universal / deep linking, JitsiMeetView offers 2 class methods that you app's delegate should call in order for the app to follow those links.

-  (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
  restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
{
  return [JitsiMeetView application:application
               continueUserActivity:userActivity
                 restorationHandler:restorationHandler];
}

And also one of the following:

// See https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623073-application?language=objc
- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  return [JitsiMeetView application:app
                            openURL:url
                            options: options];
}

or

// See https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623112-application?language=objc
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation
{
  return [JitsiMeetView application:application
                            openURL:url
                  sourceApplication:sourceApplication
                         annotation:annotation];
}

NOTE: The latter is deprecated.

JitsiMeetViewDelegate

This delegate is optional, and can be set on the JitsiMeetView instance using the delegate property.

It provides information about the conference state: was it joined, left, did it fail?

All methods in this delegate are optional.

conferenceFailed

Called when a joining a conference was unsuccessful or when there was an error while in a conference.

The data dictionary contains an "error" key describing the error and a "url" key with the conference URL.

conferenceJoined

Called when a conference was joined.

The data dictionary contains a "url" key with the conference URL.

conferenceLeft

Called when a conference was left.

The data dictionary contains a "url" key with the conference URL.

conferenceWillJoin

Called before a conference is joined.

The data dictionary contains a "url" key with the conference URL.

conferenceWillLeave

Called before a conference is left.

The data dictionary contains a "url" key with the conference URL.

enterPictureInPicture

Called when entering Picture-in-Picture is requested by the user. The app should now activate its Picture-in-Picture implementation (and resize the associated JitsiMeetView. The latter will automatically detect its new size and adjust its user interface to a variant appropriate for the small size ordinarily associated with Picture-in-Picture.)

The data dictionary is empty.

loadConfigError

Called when loading the main configuration file from the Jitsi Meet deployment fails.

The data dictionary contains an "error" key with the error and a "url" key with the conference URL which necessitated the loading of the configuration file.

Picture-in-Picture

JitsiMeetView will automatically adjust its UI when presented in a Picture-in-Picture style scenario, in a rectangle too small to accommodate its "full" UI.

Jitsi Meet SDK does not currently implement native Picture-in-Picture on iOS. If desired, apps need to implement non-native Picture-in-Picture themselves and resize JitsiMeetView.

If pictureInPictureEnabled is set to YES or delegate implements enterPictureInPicture:, the in-call toolbar will render a button to afford the user to request entering Picture-in-Picture.

Dropbox integration

To setup the Dropbox integration, follow these steps:

  1. Add the following to the app's Info.plist and change <APP_KEY> to your Dropbox app key:
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLName</key>
    <string></string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>db-<APP_KEY></string>
    </array>
  </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>dbapi-2</string>
  <string>dbapi-8-emm</string>
</array>
  1. Add the following to the app's AppDelegate:
- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  return [JitsiMeetView application:app
                            openURL:url
                            options:options];
}