Skip to main content
Version: 3.x.x

Geo Tag Room Recordings - Android

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

A ready-to-use template for this use case is here. To use this template with your recordings, follow the instructions 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. Recording with a template needs the templateUrl field of the Start Recording REST API. The Android SDK's room.startRecording() has no template parameter, so call the REST API from your server. Build the template URL from the room ID, passed as the meetingId query parameter, and a token. The template above also needs the extra parameters shown below.
async function main() {
const roomId = "YOUR_ROOM_ID";
const token = "YOUR_TOKEN";
const templateHost = "YOUR_TEMPLATE_HOST"; // where you deployed the template, e.g. template.example.com
const templateUrl = `https://${templateHost}/?meetingId=${roomId}&token=${token}&name=recorder&isRecorder=true&joinWithoutUserInteraction=true`;

console.log(templateUrl);
}

main();
  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 roomId = "YOUR_ROOM_ID";
const token = "YOUR_TOKEN";
const templateHost = "YOUR_TEMPLATE_HOST"; // where you deployed the template, e.g. template.example.com
const templateUrl = `https://${templateHost}/?meetingId=${roomId}&token=${token}&name=recorder&isRecorder=true&joinWithoutUserInteraction=true`;

console.log(templateUrl);

// Using the template URL created above and starting the recording using the API.
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​

Send the coordinates with PubSub. The template above listens on the GEO_TAG topic. Publish the participantName, latitude and longitude of the participant whose location you want to show in the recording.

note
  • Get the participant's latitude and longitude on the device before you publish them.
  • publish() is a suspend function, so call it from a coroutine.
  • Publish after the participant has joined the room. Before that, while the room is reconnecting, or when the message could not be sent, publish() throws VideoSDKException.

Here is how to publish the message:

private fun sendMessage() {
// publish message
val options = PubSubPublishOptions(persist = true)
val geoTagData = JSONObject()
geoTagData.put("latitude", "PARTICIPANT LATITUDE")
geoTagData.put("longitude", "PARTICIPANT LONGITUDE")
geoTagData.put("participantName", "PARTICIPANT NAME")

lifecycleScope.launch {
try {
room!!.pubSub.publish("GEO_TAG", "GEO_TAG_DATA", options, geoTagData)
} catch (e: VideoSDKException) {
Log.e("VideoSDK", "Publish failed: ${e.code} ${e.name}")
}
}
}

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