Let's edit the video_upload.cfm
file to add the code required to convert this video to an Internet-viewable format.
1. In the
video_upload.cfm
file, in ourVideoShare
folder, add the following lines of code; we will go through what they do in a second:<cfscript> ... VideoObj.setUser(User); VideoObj.setUploadedAt(Now()); EntitySave(VideoObj); newName = CreateUUID(); videoName = newName & ".flv"; </cfscript> <cfvideo action="convert" profile="internet" source="uploads/#VideoObj.getOriginalFile()#" destination="videos/#videoName#"> <cfscript> VideoObj.setFile(newName); VideoObj.setConvertedAt(Now()); VideoObj.setStatus(1); EntitySave(VideoObj); </cfscript> <cf_layout section="Video Uploaded!">
2. In the previous code, we started by creating the
newName
variable for our video. This is done by using theCreateUUID()
function, which will give us a unique string for our converted video. This is a shortcut...