Prerequisites
- Set up FiveMesh CDN and install the FiveMesh SDK with a key that has
cdn:write. This guide uses the SDK’s upload URL export. - Install ScreenCapture as
screencapture. The examples use the exports available in v0.17.2. - Start both resources before the resource that runs these examples. If your key has path restrictions, allow
captures.
Create an upload URL
Place this helper in your server Lua file above the capture functions. It gives each capture its own upload URL, folder and MIME restriction. The API key stays in the SDK’s server configuration.Upload a screenshot
Call this function from your server script with the connected player’s server ID. Pass"blob" to remoteUpload so it sends multipart file data. The callback receives the decoded FiveMesh response.
Upload a video clip
Call this function with the connected player’s server ID.startVideoCaptureUpload records a 10-second WebM clip and uploads it after the recording ends. The FiveMesh response is in result.response.
Verify uploads
Trigger both functions through your capture workflow. Open the public URLs and check for the files undercaptures/screenshots and captures/clips in the CDN object browser.
If a capture fails, check the server console for ScreenCapture errors. For longer clips, leave enough time for recording and transfer before the upload URL expires. If the file exceeds your upload limit, shorten the clip or reduce the capture dimensions.