Capturing video

I want to make it so when you click a camera button you record a video which is then saved. I’ve alreday got the button part, but not the recording part. Here’s my code;

local params = {}

local function Test_no_1(contentId)
	print(contentId)
end

local VideoCaptureService = game:GetService("CaptureService")  

if VideoCaptureService then
	local success, errorMessage = pcall(function()
		VideoCaptureService:StartVideoCaptureAsync(Test_no_1, params)  
	end)

	if not success then
		warn(errorMessage)  
	else
		print("Video start")  
		wait(5)
		VideoCaptureService:StopVideoCapture()
	end
end  

Thank you!

what’s the issue you’re having? StartVideoCaptureAsync returns Enum.VideoCaptureResult, perhaps try printing errorMessage wherever you’re printing video start and check what result you’re getting.

When doing that I just get a nil.

and what is the issue you’re having? on what part are you getting stuck

On recording the video.

oh yeah you are getting nil because you have to return the result from StartVideoCaptureAsync()
change

	local success, errorMessage = pcall(function()
		VideoCaptureService:StartVideoCaptureAsync(Test_no_1, params)  
	end)

to

	local success, errorMessage = pcall(function()
		return VideoCaptureService:StartVideoCaptureAsync(Test_no_1, params)  
	end)

then print errorMessage

1 Like

Okay, now it prints ‘Enum.VideoCaptureResult.NoDeviceSupport’.

Well seems like your device doesn’t support video captures, since roblox hasn’t documented a lot about this service yet, i assume it’s still under development, and not fully working yet. However you can try publishing your game and trying on a different device, maybe that works.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.