You can use EnableX Video Service to save Application data related to your Video Room, Owners, Users and Sessions. These data can be retrieved later in-session and post-session through API Call

Table of Contents

Overview

This is a limited data storage service from EnableX Video using which application developers can build Video Room based utilities that requires in-session data flow and across session data persistency.

This is a Subscription based Service.

Basic Understanding

Lets understand the basics of Data Store to know what you can store and for how long. This will help you make use of Data Store service effectively.

Object Hierarchy

  • Application
    • When you create a Video Project or Application using Portal, its assigned with an app_id.
    • EnableX Video resources are accessible to this app_id. Therefore it is the Parent Object. Everything else comes under it.
  • Video Room
    • All Video Rooms created using Video API are created under the Application i.e. app_id.
    • Video Room created is identified by room_id.
    • Further, each Video Room has a Owner, referred as owner_ref.
  • Video Session
    • Video Sessions are held in a Video Room.
    • One Video Room may have one or more Video Sessions.
    • A single Video Session is identified by by conf_num, i.e., Conference Number.
  • End User
    • End User joins a Video Session from different type of end-point / devices.
    • Each User connected with a Video Session is identified by a client_id assigned to him.
    • Every time a user rejoins or reconnects a Video Session he is assigned with a new client_id.

Scope of Data Store

As you understood Object Hierarchy, their identifier and few other entity there in; be informed that following type of data you can store in Video Service.

  • Application Data:
    • You can save Application level data.
    • In-Session Availability: This data is available to all Video Rooms and Sessions therein. Data is automatically made available to the Session on session initiation.
    • Retention Period: Data is retained till 7 days past Application suspension.
  • Room Data:
    • You can save Video Room level data.
    • In-Session Availability: This data is accessible across all Sessions done in that Room.. Data is automatically made available to the Session on session initiation.
    • Retention Period: Data is retained until a Room is deleted or til 7 days past Application suspension.
  • Owner Data:
    • You can save Room Owner level data.
    • In-Session Availability: This data accessible across all Sessions done in all Video Rooms owned by the same Owner. Data is automatically made available to the Session on session initiation.
    • Retention Period: Data is retained till 7 days past Application suspension.
  • User Data:
    • You can save User level data.
    • In-Session Availability: This data is accessible across all Video Rooms whenever user joins a Session.
    • Retention Period: Data is retained till 7 days past Application suspension.
  • Session Data:
    • YOu can save Session Level data.
    • In-Session Availability: This data is accessible within the same Session. However, if needed, it may be made available in subsequent sessions in the same Video Room.
    • Retention Period: Data is retained for 7 days only.

Pre-requisite

  • Subscription: Its a subscription based service. Ensure that your plan has this add-on.
  • For Owner-level data store:
    • You must use unique user-id of the user as owner_ref while creating room.
    • The same user-id needs to be used as user_ref while creating a Token for the user. When this user joins a Video Session, he gets access his owner data.
    • Therefore, if unique user-id is not used as owner_ref (With Room) and user_ref (With Token), you can’t make user of Data Store service effectively.
  • For user-level data store:
    • You must use unique user-id for each user as user_ref while creating Token for them. When users join Video Session, they get access to their own user data.
    • Any data saved at user level will be saved against the joined user’s user_ref.
    • Therefore, if unique user-id is not used as user_ref (With Token), you can’t make user of Data Store service effectively.

SDKs to store and retrieve Data

All Video SDKs has methods to store and retrieve data of different scope. The examples given here using Web SDK only. For all other SDKs, you need to refer to related SDK Documentation.

SDK Support for different data scope

  • Application Level: SDK can’t alter data. Read only.
  • Room Level: SDK can create, edit, delete data. JSON Objects, arrays can be defined.
  • Room Owner Level: SDK can’t alter data. Read only.
  • Session Level: SDK can create, edit, delete data. JSON Objects, arrays can be defined.
  • User Level: SDK can create, edit, delete data. JSON Objects, arrays can be defined.

Retrieve from Data Store

Use the following method to retrieve data of different scope to use them in-session.

Method: getCustomData(options, callback)

Parameters:

  • options: JSON Object with configurable options to retrieve the right data.
    • scope: Enumerated values: app, user, owner, session, room
      • With “app” scope, no further qualifier is needed. It returns App level custom data.
      • With “owner” scope, no further qualifier is needed.  It returns custom data for connected Room’s Owner-Ref.
      • With “room” scope, no further qualifier is needed. It returns custom data for connected Room.
      • With “user” scope, “user_ref” will also be used to get custom data for that user.
      • With “session” scope, optionally either “session” or “conf_num” qualifier be used to get data for requested sessions. If neither is used, it returns current session data.
    • user_ref:
      • It is required with “user” scope. It returns custom data for the given user_ref.
      • It is option with “session” scope. It returns session data for the given user_ref.
    • session: It is used with “session” scope. Optional. Values:
      • “all” – for all session data of the same room. 
      • “last” – for last session data of the same room. 
    • conf_num: It is used with “session” scope. Optional. It takes the conf_num of session for which data is needed.

Example: scope=user

Please note the Options input may have different keys for querying different scope. To get user “XOXO” data, use the following option:

var Options = {	
	"scope": "user",
	"user_ref": "XOXO"	
}

You receive following response:

{	"result": 0,              
	"clientId": "",             
	"name": "",                  
	"user_ref": "",              
	"role": "participant",       
	“data”: {	/* This is your own Data */
		“custom_data1”: “String”,
		“custom_data2”: “String”,
		“in_session_new_data”: “String”, 
		“in_session_new_data”: “String”  
	}
}

Set & Reset Data

Use the following method to set, update data of different scope in the Video Session.

Method: setCustomData(scope, data, callback)

Parameters:

  • scope: Enumerated values: user, room, session. Each scope, will have different “data” structure.
  • data: JSON Object related to scope. 

Example: data” parameter for scope “user”. This is executed from end point to affect the connected user’s data only.

var data = {
	"custom_data1": "String",		// update
	"custom_data2": "String",
	"in_session_new_data": "String",	// new
	"in_session_new_data": "String"
}

Example: E.g. “data” parameter for scope “session”. This is executed from any end point to affect current session only

var session_data = {
	"poll": {
		"question: "String",	 
		"options": [{
			"opt": "String",
			"response": Number	
		}]
	}
}

Save data to Data Store

Refer in detail

To read detailed implementation in different SDKs, follow the links given below: