Swiftpack.co - Package - cafexcomms/cafex-meetings-ios

CafeXMeetingsSDK

This CocoaPod is used to access the CafeX Meetings Cloud service. This framework is iOS specific (iOS 9.0 or later) and is used to overcome the current limitations of the iOS embedded browser.

A description of the CafeX Meetings service is available here: https://www.cafexmeetings.com/

And the location of the cloud service for it is: https://meetings.cafex.com/

Version information

This is version 2.4.8 of the CafeX-Meetings library.

This release has no functional changes but the deployment process has changed as we have switched to source distribution.

Also, to clear any potential confusion between the CafeX Meetings application and the SDK itself the SDK CocoaPods name is now CafeXMeetingsSDK (previously was CafeX-Meetings).

A side-effect of these two changes is that the name of the imported package has changed. It used to be:

import CHConference

It is now:

import CafeXMeetingsSDK

For full release notes information, please consult the CHANGELOG.md file.

Installation

Via CocoaPods

CafeXMeetingsSDK is available through CocoaPods

To install the CafeX Meetings iOS SDK to your project add the following to your Podfile:

pod "CafeXMeetingsSDK"

and enter the following in to your commandline at the working directory of your podfile

pod install --repo-update

If your project already uses CafeX-Meetings then it will be necessary to update the dependency using the command:

pod update CafeXMeetingsSDK

CocoaPods will confirms the update by logging a message similar to the following one:

Installing CafeXMeetingsSDK 2.4.8 (was 2.4.x)

Manual

To manually install, download the framework CafeXMeetingsSDK.zip, unpack it. Then drag and drop the CafeXMeetingsSDK.xcodeproj file into to root of your XCode project.

Then you need to do the following:

  • In your target "Build Phases", add the CafeXMeetingsSDK in the "Target Dependencies" section.
  • In your project general settings, you click the '+' button in the "Embedded Binaries" section in order to select and add the CafeXMeetingsSDK.framework.

CafeXMeetingsSDK also relies on WebRTC.framework, which can be found here (or you can follow the build instructions here).

You will need to unzip it and copy the WebRTC.framework file (as well as the .dSYM) into the Frameworks folder of the unpacked CafeXMeetingsSDK source. This is important as the CafeXMeetingsSDK project file expects it to be there (and it won't compile otherwise).

You then you need to do the following:

  • In your project general settings, you click the '+' button in the "Embedded Binaries" section in order to select and add the WebRTC.framework.

The project should then compile successfully.

Usage

To call CHConference functions use

import CafeXMeetingsSDK in swift, #import "CafeXMeetingsSDK.h" in Objective-C

The entry point of the CafeXMeetingsSDK framework is the ConferenceViewController. To present a conference use the following code from the current viewController:

let conferenceViewController = ConferenceViewController()
//setup conferenceViewController frame with view.frame or autolayout constraints e.g
conferenceViewController.view.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height)
//set host address of the CafeX Meetings server instance
conferenceViewController.setHostURL(hostURL: "https://yourserver.com:8443/")
//add the view to the current view controller and add the conference view controller as a child.
self.view.insertSubview(conferenceViewController.view, belowSubview: self.cancelButton)
self.addChildViewController(conferenceViewController)
//join the conference
conferenceViewController.join(meetingId: "meetingID")
})

note: If implemented within a completion block or callback (such as from the result of a network call), The above methods will need to be queued on the main thread. e.g

DispatchQueue.main.async{
⋮ 
}

If using storyboard the ConferenceViewController can be embedded in another view controller using the Container View element:

Screen Shot 2017-06-07 at 13.59.33.png

In order to make the embedded view controller a ConferenceViewController, click on the embedded view controller and Change the custom class to "ConferenceViewController" and the Module to "CHConference"

Screen Shot 2017-06-07 at 14.01.12.pngScreen Shot 2017-06-07 at 14.03.19.png

In order to set the options for our conference, first select the segue in the storyboard and give it a unique identifier Screen Shot 2017-06-07 at 14.07.24.png

In your embedding view implement the following:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.
    if segue.identifier == "embedConferenceView" {
        dest.setHostURL(hostURL: "https://yourserver.com:8443/")
        dest.join(meetingID: "meetingId")
    }
}

Delegate Functions

The ConferenceViewController contains functions to respond to in meeting events. To implement these functions, inherit : ConferenceViewControllerDelegate in your class declaration. When setting up your Conference View controller, set the delegate to a class that inherits ConferenceViewControllerDelegate

class viewController: UIViewController, ConferenceViewControllerDelegate {
    ...
    conferenceViewController.delegate = self
    ...
}

Meeting Started

Called when the meeting starts

func meetingStarted() {
    print("ConferenceViewControllerDelegate : Meeting Started")
}

Meeting Ended

Called when the meeting ends

func meetingEnded() {
    print("ConferenceViewControllerDelegate : Meeting Ended")
}

Join Failed

Called if joining a conference fails. See also conferenceViewController:DidRecieveError:

func joinFailed() {
    print("ConferenceViewControllerDelegate : joinFailed")
}

Participant Joined

Called when any participant joins

func participantJoined(userDetails: UserDetails) {
    print("ConferenceViewControllerDelegate : participantJoined")
}

Participant Available

Called when a participant becomes available in the conference

func participantAvailable(userDetails: UserDetails) {
    print("ConferenceViewControllerDelegate : participantAvailable")
}

Participant Updated

Called when a participant is updated

func participantUpdated(userDetails: UserDetails) {
    print("ConferenceViewControllerDelegate : participantUpdated")
}

Participant Left

Called when a participant leaves the conference

func participantLeft(userDetails: UserDetails) {
    print("ConferenceViewControllerDelegate : participantLeft")
}

Conference view controller did receive error

Called when an error occurs during the conference

func conferenceViewController(_ controller: ConferenceViewController, didRecieveError error: NSError) {
    print("ConferenceViewControllerDelegate : didReceiveError")
}

Conference view controller did finish connecting to conference

Called when our participant finishes connecting to the conference

func conferenceViewController(_ contoller: ConferenceViewController, didFinishConnectingToConference conference: String) {
    print("ConferenceViewControllerDelegate : didFinishConnectingToConference: \(conference)")
}

Meeting Locked

Called when the current conference is locked by its owner

func meetingLocked(lockedBy: String) {
    print("Meeting locked by: \(lockedBy)")
}

Meeting Unlocked

Called when the current conference is unlocked by its owner

func meetingUnlocked(unlockedBy: String) {
    print("Meeting unlocked by: \(unlockedBy)")
}

Audio Event

Called when the state of the out-going audio is changed, e.g muted and and unmuted

func audioEvent(state: String) {
    print("Audio event received: \(state)")
}

Camera Event

Called when the state of out-going video is changed, e.g camera turned on or off

func cameraEvent(state: String) {
    print("Camera event received: \(state)")
}

Send Chat Message

Called when a chat message has been sent by the user

func sendChatMessage(messageContent: String) {
    print("Chat message send: \(messageContent)")
}

Received Chat Message

Called when a chat message is received

func receivedChatMessage(messageContent: String, from: [String: Any]) {
    print("Chat message received from: \(from["name"] as! String) message content: \(messageContent)")
}

Document Share Event

Called when a document share is started or ended

func docShareEvent(event: String) {
    print("Doc share event received: \(event)")
}

Screen Share Event

Called when a Screen share is started or ended

func screenShareEvent(event: String) {
    print("Screen share event received: \(event)")
}

Support

For support please contact support@cafex.com

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: