Created
March 18, 2018 20:18
-
-
Save lfreeland/33209d07e38d0f68eb34788a1ee4c220 to your computer and use it in GitHub Desktop.
Lightning Record Video Viewer Component Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ({ | |
| 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