Video recording without authentication

There are some scenarios in which you will need to expose NativeVideo capabilities to a public audience that is not provided with Salesforce credentials. In order to offer such functionality, we need to create a Salesforce Community or Site that exposes public pages, and then embed our NativeVideo components. In this section we will be focusing on the recording feature run by a Guest user.


Few things we need to be aware of:

  • If the running user is not authenticated, the only recording scenario that is made available is the One to One, so we need to model our data structure providing an object that exposes one lookup to the video
  • The same visibility concepts and assumptions are still valid and referred to the Site Guest User. In essence, the Guest User profile must have Read and Write access to the target record and the Public Access Settings of the Site must unlock visibility on the target object, with editing capabilities on the video lookup field 
  • The Site Guest User must be associated to the "NativeVideo Permissions" permission set
  • NativeVideo provides an out of the box mechanism to protect the public page, adding an extra parameter to control the access to the page. The value of this parameter will have to be provided to the component, indicating also the API name of the field that should be matching it. We'll come back on this later on this page.


Let's take a more practical approach and walk through the key steps of an hypothetical implementation:

  1. In your target object, add a new text field and build a logic to populate this field with a random string
  2. Develop a Lightning component that:
    1. Reads from the URL the token value, passed as a GET parameter
    2. Dynamically creates a new VideoRecord instance, specifying the following parameters:
      1. "tokenField", with the field API name on the target object that stores the value of the token
      2. "token", with the token value read from the URL
  3. Include the component just developed in a page exposed to the public, either via Salesforce Communities (Salesforce Lightning) or through a Site (Salesforce Classic)


An example of the code specified for the component mentioned at the second point of the above list is:

showVideoRecorder : function(component, event, helper) {
		var urlParameters = helper.fetchURLParameters();
		$A.createComponent(
			"nativevideo:VideoRecord",
			{
				"aura:id": "recordingInterview",
				"updateObjectName" : "Application__c",
				"updateField" : "Video__c",
				"questionnaireField" : "Vacancy__r.Interview_Questions__c",
				"tokenField" : "Secret__c",
				"successMessage" : "Thanks for recording your video interview. We will be in touch very soon!",
				"mainColour" : "FF5845",
				"updateRecordID" : urlParameters["application"],
				"token" : urlParameters["secret"]
			},
			function(newComponent, status, errorMessage) {
				if (status === "SUCCESS") {
					$A.util.addClass(component.find("candoRecordingButton"), 'slds-hide');
					component.find("candoRecordingCnt").set("v.body", newComponent);
					$A.util.removeClass(component.find("candoRecordingCnt"), 'slds-hide');
				} else if (status === "INCOMPLETE") {
					console.log("No response from server or client is offline.");
				} else if (status === "ERROR") {
					console.log("Error: " + errorMessage);
				}
			}
		);
	},


The token functionality should not been perceived as a way to completely lock down the public recording, making it extremely safe, but instead as a simple way to offer a little more security and avoiding malicious users trying to overwrite previous recordings. It is strongly recommended to develop a logic that refreshes the value of the token in Salesforce, giving a pre-defined lifetime to the URL eventually shared with the legitimate person who has to run the recording.



Conclusion & Next Steps

We have now described the key items we need to be aware of in case we want to expose video recording to the wider public, as well as listed the key steps to actually implement it. If you are now interested in the equivalent section for browsing, jump here... otherwise let's now see how to upload existing videos in NativeVideo. Next section available here.