Skip to main content
Version: 4.x.x

Geo Tag Room Recordings - iOS

To ensure compliance for BFSIs doing vKYC, it is important to include the coordinates (location) of the customer in the recordings. You can do this with a custom template.

We have created a ready to use template for this use case which can be found here. To use this template with your recordings, follow the steps below.

Host the template​

  1. Clone the template repository and switch to the branch template/geo-tag-watermark.
git clone https://github.com/videosdk-live/videosdk-rtc-react-prebuilt-ui.git
cd videosdk-rtc-react-prebuilt-ui
git checkout template/geo-tag-watermark
  1. Install the dependencies and create a build of the project using below mentioned commands.
npm install
npm run build
  1. Host the contents of the build folder on your server and check if the template is up and running.
note

If you want to create the complete template from scratch you can follow this guide.

Using the template for recording​

  1. To use the template that we deployed earlier, we will be using the templateUrl feature in the startRecording API. The iOS SDK's startRecording() has no templateUrl parameter, so start this recording from your server with the REST API. The snippets below are server-side JavaScript (Node.js 18 or later). To generate the template URL, you will have to append the meetingId, and token has to be added in the query parameters. Also if you are using the template provided above you need to add the extra parameters shown below. Here is the code snippet to generate the URL.
const templateBaseUrl = "https://your-template-url"; // where you hosted the template
const roomId = "Your Room ID";
const token = "Your Token";
const templateUrl = `${templateBaseUrl}/?meetingId=${roomId}&token=${token}&name=recorder&isRecorder=true&joinWithoutUserInteraction=true`;

console.log(templateUrl);
  1. Now that we have the template URL, we will use this URL to start the recording using the below provided API call.
async function main() {
const templateBaseUrl = "https://your-template-url"; // where you hosted the template
const roomId = "Your Room ID";
const token = "Your Token";
const templateUrl = `${templateBaseUrl}/?meetingId=${roomId}&token=${token}&name=recorder&isRecorder=true&joinWithoutUserInteraction=true`;

// start the recording with the template URL created above
const options = {
method: "POST",
headers: {
Authorization: token,
"Content-Type": "application/json",
},
body: JSON.stringify({
roomId: roomId,
templateUrl: templateUrl,
}),
};
const url = `https://api.videosdk.live/v2/recordings/start`;
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
}

main();

Updating the Geo Tagging Coordinates​

We will be using the PubSub feature of VideoSDK to update the data of latitude and longitude. For the predefined template provided by us we are using GEO_TAG as topic name. We will be publishing the participantName, latitude and longitude of the participant whose location you want to show in the recording.

note
  • You will have to fetch the longitude and latitude of the participant before sending it using the pubsub.
  • publish() is async throws. Call it with try await inside a Task after the participant has joined the room. If the publish fails, for example because the room is not joined yet, it throws a VideoSDKError.

Here is the code how you will have to publish the message:

class LiveStreamViewController: UIViewController {

var room: Room?

func sendCoordinates() {
Task {
do {
try await self.room?.pubSub.publish(
topic: "GEO_TAG",
message: "GEO TAG DATA",
options: PubSubPublishOptions(persist: true),
payload: [
"latitude": "LATITUDE OF PARTICIPANT",
"longitude": "LONGITUDE OF PARTICIPANT",
"participantName": "NAME OF PARTICIPANT"
]
)
} catch {
print("Failed to send coordinates: \(error)")
}
}
}
}

After implementing this, you should get the recording in the following format:

Geo Tagging Recording

If you wish to change how UI looks on recording, you can change it by updating the layout in the template itself.

API Reference​

The API references for all the methods utilized in this guide are provided below.

Got a Question? Ask us on discord