Skip to content

Commit 839f376

Browse files
update Open Source Docs from Roblox internal teams
1 parent 48ffb31 commit 839f376

File tree

1 file changed

+57
-21
lines changed

1 file changed

+57
-21
lines changed

content/en-us/reference/engine/classes/CaptureService.yaml

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: CaptureService
22
type: class
33
memory_category: Instances
44
summary: |
5-
A service which provides control over screenshot capture features.
5+
A service which provides control over screenshot and video capture features.
66
description: |
7-
**CaptureService** is a client-side service that allows developers to control
8-
how the screenshot capture feature integrates with their experiences. It can
9-
be used to include preset moments where a screenshot is automatically taken
10-
for a user, and that user can then save, share, or delete the screenshot.
7+
`CaptureService` is a client-side service that allows developers to control
8+
how the screenshot and video capture feature integrates with their experiences.
9+
It can be used to include preset moments where a capture is automatically
10+
taken for a user, and that user can then save, share, or delete the capture.
1111
code_samples: []
1212
inherits:
1313
- Instance
@@ -61,7 +61,7 @@ methods:
6161
summary: |
6262
Prompts the user to save specified captures to their gallery.
6363
description: |
64-
This method prompts the user to save the screenshots identified by the
64+
This method prompts the user to save the captures identified by the
6565
provided `contentIds` to their **Captures** gallery within the
6666
experience's main menu.
6767
code_samples: []
@@ -88,14 +88,14 @@ methods:
8888
writeCapabilities: []
8989
- name: CaptureService:PromptShareCapture
9090
summary: |
91-
Prompts the user to share a specified screenshot capture.
91+
Prompts the user to share a specified capture.
9292
description: |
93-
This method prompts the user to share the screenshot identified by the
93+
This method prompts the user to share the capture identified by the
9494
provided `contentId` using the native share sheet on their device.
9595
96-
The capture image is shared along with an invite link to the experience
97-
when supported. Not all devices support including both a screenshot and
98-
invite link.
96+
The capture is shared along with an invite link to the experience
97+
when supported. Not all devices support including both a screenshot or video
98+
and an invite link.
9999
100100
The `launchData` will be available in the `launchData` field for users who
101101
join through the invite link.
@@ -134,8 +134,13 @@ methods:
134134
capabilities: []
135135
writeCapabilities: []
136136
- name: CaptureService:StopVideoCapture
137-
summary: ''
138-
description: ''
137+
summary: |
138+
Ends a video capture initiated by
139+
`Class.CaptureService:StartVideoCaptureAsync()|StartVideoCaptureAsync()`.
140+
description: |
141+
This method ends a video capture that was started by the
142+
`Class.CaptureService:StartVideoCaptureAsync()|StartVideoCaptureAsync()`
143+
method.
139144
code_samples: []
140145
parameters: []
141146
returns:
@@ -170,20 +175,51 @@ methods:
170175
capabilities: []
171176
writeCapabilities: []
172177
- name: CaptureService:StartVideoCaptureAsync
173-
summary: ''
174-
description: ''
178+
summary: |
179+
Initiates a video capture recording.
180+
description: |
181+
This method initiates a video capture recording. The recording will
182+
continue until the `Class.CaptureService:StopVideoCapture()|StopVideoCapture()`
183+
method is called, or when 30 seconds have passed, whichever comes first.
184+
185+
During the video recording, all user voices are muted.
186+
187+
The `onCaptureReady` callback can be used to prompt the user to save or
188+
share the video capture.
189+
190+
```lua
191+
local CaptureService = game:GetService("CaptureService")
192+
193+
local onCaptureReady = function(videoCapture, result)
194+
if result ~= Enum.VideoCaptureResult.Success or not videoCapture then
195+
print("Video recording failed to complete for reason: " .. tostring(result))
196+
else
197+
-- Prompt the user to save the video capture to their gallery
198+
CaptureService:PromptSaveCapturesToGallery({ Content.fromObject(videoCapture) })
199+
end
200+
end
201+
202+
local videoRecordingAllowedResult: Enum.VideoCaptureStartedResult = CaptureService:StartVideoCaptureAsync(onCaptureReady, {})
203+
204+
if videoRecordingAllowedResult ~= Enum.VideoCaptureStartedResult.Success then
205+
print("Video recording failed to start for reason: " .. tostring(videoRecordingAllowedResult))
206+
end
207+
```
175208
code_samples: []
176209
parameters:
177210
- name: onCaptureReady
178211
type: Function
179212
default: ''
180-
summary: ''
213+
summary: |
214+
A callback function that is called with the `Class.VideoCapture`
215+
object and the result of type `Enum.VideoCaptureResult` of the video capture
216+
once it is ready.
181217
- name: captureParams
182218
type: Dictionary
183219
default: nil
184220
summary: ''
185221
returns:
186-
- type: VideoCaptureResult
222+
- type: VideoCaptureStartedResult
187223
summary: ''
188224
tags:
189225
- Yields
@@ -197,9 +233,9 @@ events:
197233
summary: |
198234
Fires immediately before a capture begins.
199235
description: |
200-
This event fires right before a new screenshot capture is taken. It can be
201-
used to customize the capture experience, for example by hiding certain
202-
GUI elements.
236+
This event fires right before a new capture is taken. It can be
237+
used to customize the capture experience, for example by hiding
238+
certain GUI elements.
203239
code_samples: []
204240
parameters:
205241
- name: captureType
@@ -215,7 +251,7 @@ events:
215251
summary: |
216252
Fires after a capture finishes.
217253
description: |
218-
This event fires after a new screenshot capture completes. It can be used
254+
This event fires after a new capture completes. It can be used
219255
to restore any changes made when the
220256
`Class.CaptureService.CaptureBegan|CaptureBegan` event fired.
221257
code_samples: []

0 commit comments

Comments
 (0)