When you enable Live Experience meeting support in your app, you provide a URL to a
customer that they can click to join a meeting instance that you configured.
Meeting URLs are composed of a base URL and a meeting code. The base URL is
application-specific and is entered in the Admin Console, for example,
orcl://www.example.com/meeting. When an associate creates a
meeting and sends the URL to the user, the final URL might look like
orcl://www.example.com/meeting/DGGD2KAU.In order to process
meeting URLs, you need configure the base URL to automatically load your Live
Experience-enabled app, and pass the meeting code to it using either https://developer.apple.com/documentation/uikit#//apple_ref/doc/uid/TP40007072-CH6-SW1 or https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html.
Follow this procedure to build a single
viewcontroller meeting app and process meeting URLs using the URL schemes
method.
-
Create a new Single View App project in Xcode.
-
Configure the project settings as described in Preparing Your iOS App for the Live Experience Widget.
-
Expand your application folder within the project view and select
Info.plist.
-
Select any row in the Information Property List and click
+.
-
Enter URL types.
-
Expand URL types, then Item 0,
and click +.
-
Enter URL Schemes, expand Item 0,
and set
orcl
as a string value.
-
Configure the Controller shared service settings as described in Adding and Configuring the Live Experience Widget for your iOS App in the UIViewController
viewDidLoad
callback.
-
Set the following additional controller shared settings:
Controller.shared.settings.startVideoInFullScreen = true
Controller.shared.settings.startVideoWithFrontCamera = true
-
Handle authentication in the
viewDidLoad
callback as described
in Authenticate with Live Experience for iOS.
-
In the
viewDidLoad
callback, initialize the
appLocation
as Meeting, a default
scenario which enables Live Experience meeting functionality:
Controller.shared.contextAttributes.setValue("Meeting", forKey:
"appLocation")
-
Configure your app to extract the meeting code when the URL is tapped by
overriding the
application(_:open:options:)
method in
UIApplicationDelegate
(generated by Xcode as
AppDelegate.swift
by default). That method is called when
the app is opened for the URL scheme you defined earlier.
The following example extracts the meeting code and posts it to a
notification:
func application(_ app: UIApplication,
open url: URL,
options: [UIApplicationOpenURLOptionsKey : Any] = [:])
-> Bool {
let components = url.absoluteString.components(separatedBy:"/")
if components.count > 2 {
var notification = Notification.init(name: NSNotification.Name("MeetingNotification"))
notification.object = components.last
NotificationCenter.default.post(notification)
}
return true
}
-
Configure the view controller to display the widget when the notification comes
in. In the view controller
viewDidLoad
callback, register
yourself as a listener for the meeting notifications:
NotificationCenter.default.addObserver(
self,
selector: #selector(MeetingViewController.onMeeting(notification:)),
name: NSNotification.Name("MeetingNotification"),
object: nil)
-
Implement the meeting processing method callback,
onMeeting
:
@objc private func onMeeting(notification: NSNotification) {
if let meetingCode = notification.object as? String {
Controller.shared.contextAttributes.setValue(meetingCode,
forKey: "meetingCode")
Controller.shared.addComponent(viewController: self)
}
}
-
You'll need to handle timing issues, since there's no guarantee that you've
been authenticated before you try to start the meeting. Add the following
variables to the view controller:
private var authenticated = false
private var meetingCode: String? = nil
-
Modify the
completionHandler
for the authentication step as
well as the onMeeting
callback so that either of them start the
meeting depending on which one completes first.
Add the following to
completionHandler
:
// Last part of the authentication
Controller.shared.service.authToken = token
Controller.shared.contextAttributes.setValue("Meeting", forKey: "appLocation")
self.authenticated = true
if let _ = self.meetingCode {
Controller.shared.addComponent(viewController: self)
}
Revise
onMeeting
as follows:
// Revised version of onMeeting
@objc private func onMeeting(notification: NSNotification) {
if let meetingCode = notification.object as? String {
Controller.shared.contextAttributes.setValue(meetingCode,
forKey: "meetingCode")
if self.authenticated == true {
Controller.shared.addComponent(viewController: self)
} else {
self.meetingCode = meetingCode
}
}
}