📸CaptureRequest

This is main API for capturing player's screen.

I also recommend to check promise documentation since CaptureRequest heavily uses promises

RSC.CaptureRequest.New

CaptureRequest RSC.CaptureRequest.New()

Creates a new CaptureRequest object.

.onMessage

request.onMessage = RSC.Event.New()
-- :On(function( request: CaptureRequest, type: MESSAGE_TYPE, message: str, source: MESSAGE_SOURCE ) end)

This event emitted when CaptureRequest receive new message. Event arguments:

-- Example of using request.onMessage event
local request = RSC.CaptureRequest.New()
-- Print every message
request.onMessage:On(function(request, type, message) print(message) end)
-- Capture a player with index 1
request:Capture( Entity(1) ):Await()

-- Printed messages to console:
-- #rsc.notify.copying_screen
-- #rsc.notify.screen_to_image
-- ...

.onResult

This event emitted when CaptureRequest receive result. Event arguments:

:Capture(...)

Starts a capture of given player. You can also specify service name (by default recommended) and quality level (by default 2). Also it will wait until capture queue is free and capture has successfully requested. Also this function can fail.

Errors:

  • Requester doesn't have enough rights #rsc.errors.no_rights Clientside only

  • Invalid victim #rsc.errors.invalid_victim

  • Invalid service (rarely can happen) #rsc.errors.invalid_service

  • Trying to start new :Capture(...) while in in queue already in queue

:WaitForResult()

Returns a promise that will be fulfilled with a capture result. If capture failed, then promise become rejected with a capture fail reason. Internally used in CaptureRequest:GetDownloadURL() and CaptureRequest:Download().

:GetDownloadURL()

Gets a download url after result received. Can also throw an error. Same as request:GetService():GetDownloadURL( result, request:GetQuality(), request:GetPrepareData() )

:Download()

Downloads capture image after result received. Can also throw an error. Same as request:GetService():Download( result, request:GetQuality(), request:GetPrepareData() )

:IsValid()

:IsInQueue()

:IsEnded()

:GetVictim()

:GetService()

:GetQuality()

:GetUniqueID()

Only valid after successful :Capture()

:GetPrepareData()

:GetReceivers()

:IsOk()

:GetResult()

:AddReceiver(...)

Last updated