Skip to content

Instantly share code, notes, and snippets.

@lfreeland
Created March 18, 2018 20:18
Show Gist options
  • Select an option

  • Save lfreeland/33209d07e38d0f68eb34788a1ee4c220 to your computer and use it in GitHub Desktop.

Select an option

Save lfreeland/33209d07e38d0f68eb34788a1ee4c220 to your computer and use it in GitHub Desktop.
Lightning Record Video Viewer Component Controller
({
init: function(cmp, event, helper) {
var recordId = cmp.get('v.recordId');
var videoField = cmp.get('v.videoField');
if (!recordId || !videoField) {
console.log('The record id or video field is missing.');
return;
}
var getVideoURLAction = cmp.get('c.getVideoURL');
getVideoURLAction.setParams({
recordId: recordId,
videoField: videoField
});
getVideoURLAction.setCallback(this,
function(response) {
var state = response.getState();
console.log('RecordVideoViewer getVideoURL callback');
console.log("callback state: " + state);
if (cmp.isValid() && state === "SUCCESS") {
var videoSrcUrl = response.getReturnValue();
cmp.set('v.videoSrcUrl', videoSrcUrl);
}
}
);
$A.enqueueAction(getVideoURLAction);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment