Captures APIs are now available!

This is a neat feature, but I think that limiting it to screenshots only is holding it from what it can be. If users had the ability to like capture the last 30 seconds in game and share like a cool moment, or a funny moment, or a funny bit that’s happening in game I could see this feature be used and shared even more than it is currently. There’s some games that could benefit from this but it doesn’t make sense because it only supports screenshots and it wouldn’t make sense to implement this in games in its current state.

6 Likes

An error will be thrown if the user is not able to share content (i.e it’s not supported or their privacy settings do not allow this). The developer can check the new PolicyService IsContentSharingAllowed field to avoid this error.

This does not seem to actually exist yet? At least not in Studio.

5 Likes

Will we be able to write the captures to a DynamicImage in the future? And will we be able to capture from a specific camera instance in the future?

5 Likes

you can write to dyn images

6 Likes

I knew this was comming out! I wanted this as well and it came out

5 Likes

How temporary are the given ContendIDs of the captures?
Would they get deleted after the Player leaves the experience or persist throughout?
Are they also considered an Image asset type to be used in places such as ImageFrames or Decals?

3 Likes

Excellent feature! I strongly support @NotRapidV idea to be able to use the screenshots in-game. I have a social feed in the game where people can share what they’re up to. Allowing them to post photos would greatly enhance immersion

6 Likes

The temporary ContentIds will be available for one session only, so they won’t be available between sessions. To have the screenshot be available to the user after they leave the game you will need to prompt them to save the screenshot.

The temporary ContentId should work anywhere image ContentIds currently work, including in ImageLabels and Decals.

8 Likes

Hmm… I just wished there was a way to turn this into an editable image, without the user needing to save the image.

5 Likes

Currently, users can only take captures on mobile devices.

-- okay a far bigger issue is that there is doesn’t seem to be any way to check if the user is actually able to take captures?? CaptureScreenshot runs just fine on PC as my share buttons are appearing, but then the two Prompt functions just do not do anything at all, leaving me with two functionless buttons on PC.

-- this would be easier to deal with if we finally got a proper way of detecting if a user is on a mobile device btw, this obsession with never letting us simply detect what type of device the user is using straight up is becoming more and more of a problem as more inconsistencies like this begin showing up across different platforms

6 Likes

Interesting, how so? This could be used for a social media type feed right?

2 Likes

when you call
CaptureService:CaptureScreenshot(onCaptureReady(contentId))

you simply pass the contentId argument to AssetService:CreateEditableImageAsync()

could be used for a social media type feed right?

you’d need to come up with a way on how to compress the raw RGBA image data

the maximum image size for EditableImages is 1024x1024, translating that to raw RGBA size is 4194304 bytes or 4.1 megabytes :grimacing:

6 Likes

This is what I came up with. It will work, but the data is quite large. You can send the data you receive from the function to other players and create a new image with EditableImage:WritePixels(data). The question is, how safe is it to show to other players? Can a client somehow display a non-game image? If so, you shouldn’t use this solution

local assetService = game:GetService("AssetService")
local captureService = game:GetService("CaptureService")
local function readCapturedScreenshot(callback)
	local screenshotData = nil
	captureService:CaptureScreenshot(function(contentId)
		local editableImage = assetService:CreateEditableImageAsync(contentId)
		editableImage.Parent = workspace
		if editableImage.Size.X > 1024 then
			editableImage:Resize(Vector2.new(1024, 1024 * (editableImage.Size.Y / editableImage.Size.X)))
		end
		if editableImage.Size.Y > 1024 then 
			editableImage:Resize(Vector2.new(1024 * (editableImage.Size.X / editableImage.Size.Y), 1024))
		end
		screenshotData = editableImage:ReadPixels(Vector2.new(), editableImage.Size)
		callback(screenshotData)
	end)
end

readCapturedScreenshot(function(data)
	print(string.len(game:GetService("HttpService"):JSONEncode(data)))  -- the screenshot is around 24 MB, its quite a lot :/
end)
3 Likes

That will be really useful for my talk-show experience where people can meet the guest & take pictures! Thank you!

4 Likes

Does screenshot capture go through a moderation process? If I captured something that seemed against TOS, would I be moderated for it? This sounds like a good tool for reporting players/games, but I wouldn’t want to face moderation in the process.

3 Likes

you can probably get it down to around 4 megabytes if you use the full 1024x1024 or less if you have to resize it, but exploiters can technically just send a different image if you have a remote that sends the data to the server, so displaying it may not be safe.

4 Likes

Just to confirm these screenshots are not stored on Roblox’s servers globally

I ask this because if they are uploaded, would there be moderation repercussions in the case that a bad actor setups a not safe for roblox scene and calls the screenshot function without consent of the player

4 Likes

The screenshot is not stored server side at all, and it will only be stored locally for the user if the user accepts the prompt to save the screenshot. Otherwise the screenshot will be available as a temporary ContentId for the current session only.

4 Likes


is it gonna have a once per second ratelimit forever or is it just while its being worked on cause it would be pretty neat to use this for realtime postfx

14 Likes

These new properties already seem to exist but do not work yet, is that intentional?

6 Likes