This repository provides a quick start project implemented with PlanetKit for macOS.
This quick start project is based on PlanetKit 5.4.x.
PlanetKit is a client SDK for LINE Planet, which is a cloud-based real-time communications platform as a service (CPaaS) that helps you build a voice and video call environment. With LINE Planet, you can integrate call features into your service at minimum cost.
The system requirements of PlanetKit for macOS are as follows.
- macOS 10.14.6 or higher
NSMicrophoneUsageDescription
NSCameraUsageDescription
(video call only)
This quick start project provides basic functionality of a group audio call.
- Xcode 14.1 or higher
- Python 3.8 or higher
- To generate an access token, you need a supported version of Python 3.x, currently 3.8 or higher.
Clone this repository, or download this repository and unzip the files.
Open Xcode project planet-kit-quickstart-macos.xcodeproj
with Xcode.
In this quick start project, we provide a script that generates an access token for your convenience. However, during the actual implementation of your app, the access token must be created in the AppServer. For more information, refer to Access token.
Generate an access token using generate_access_token.py
.
- The script requires a valid user ID as an argument. For the naming restrictions of a user ID, see User ID.
- Python package requirement for
generate_access_token.py
can be found inrequirements.txt
.- You can use the command
pip3 install -r requirements.txt
to install required packages.
- You can use the command
We recommend using a virtual environment for this step. For more information, see how to use venv.
user@test planet-kit-quickstart-ios % python3 generate_access_token.py <YOUR_USER_ID>
access token: <GENERATED_ACCESS_TOKEN>
Copy and paste the user ID and access token into your code.
// ViewController.swift
// TODO: Set your own environment
let userId = "<YOUR_USER_ID>"
let serviceId = "planet-kit-quick-start"
let accessToken = "<GENERATED_ACCESS_TOKEN>"
....
Run the quick start project on current macOS device.
Enter a room ID and click Join to join the group call.
To join the call successfully, you need to enter a valid room ID. For the naming restrictions of a room ID, see Room ID.
One you're connected to the call, you can communicate with other participants. Click Leave to leave the group call.
If the group call cannot be connected, please check PlanetKitStartFailReason and PlanetKitDisconnectReason.
// check PlanetKitStartFailReason
// ViewController.swift
....
class ViewController: NSViewController {
....
@IBAction func joinConference(_ sender: Any) {
let param = PlanetKitConferenceParam(myUserId: myUserId, roomId: roomId, roomServiceId: serviceId, displayName: nil, delegate: self, accessToken: accessToken)
let result = PlanetKitManager.shared.joinConference(param: param, settings: nil)
print("join conference result: \(result.reason)")
}
}
// check PlanetKitDisconnectReason
// ViewController.swift
....
extension ViewController: PlanetKitConferenceDelegate {
....
func didDisconnect(_ conference: PlanetKitConference, disconnected param: PlanetKitDisconnectedParam) {
DispatchQueue.main.async {
self.state = "disconnected"
self.peerCount = 0
print("disconnected: \(param.reason)")
}
}
....
}
Please file any issues or inquiries you have to our representative or dl_planet_help@linecorp.com. Your opinions are always welcome.
You can find answers to our frequently asked questions in the FAQ section.