import GboxSDK from "gbox-sdk";
const gboxSDK = new GboxSDK({
apiKey: process.env["GBOX_API_KEY"] // This is the default and can be omitted
});
async function main() {
const box = await gboxSDK.create({
type: "android",
config: {
deviceType: "physical",
},
});
await box.action.recording.rewind.enable();
// Perform some operations...
console.info("tapping chrome app...");
await box.action.tap({ target: "chrome app" });
// sleep 3 seconds
console.info("sleeping 3 seconds...");
await new Promise((resolve) => setTimeout(resolve, 3000));
console.info("pressing home button...");
await box.action.pressButton({ buttons: ["home"] });
console.info("extracting recording...");
// Extract the last 5 seconds of the recording
const result = await box.action.recording.rewind.extract({
duration: "5s",
});
console.log(`recording download url: ${result.presignedUrl}`);
}
main();import os
import time
from gbox_sdk import GboxSDK
gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"]) # This is the default and can be omitted
def main():
box = gbox_sdk.create(
type="android",
config={
"device_type": "physical"
}
)
box.action.recording.rewind.enable()
# Perform some operations...
print("tapping chrome app...")
box.action.tap(target="chrome app")
# sleep 3 seconds
print("sleeping 3 seconds...")
time.sleep(3)
print("pressing home button...")
box.action.press_button(buttons=["home"])
print("extracting recording...")
# Extract the last 5 seconds of the recording
result = box.action.recording.rewind.extract(duration="5s")
print(f"recording download url: {result.presigned_url}")
if __name__ == "__main__":
main()curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/actions/recording/rewind/extract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"duration": "10s"
}
'{
"storageKey": "storage://gbox/recording/1234567890",
"presignedUrl": "https://gbox.ai/api/v1/boxes/1234567890/recording/1234567890"
}Extract rewind recording
Rewind and capture the device’s background screen recording from a specified time period.
import GboxSDK from "gbox-sdk";
const gboxSDK = new GboxSDK({
apiKey: process.env["GBOX_API_KEY"] // This is the default and can be omitted
});
async function main() {
const box = await gboxSDK.create({
type: "android",
config: {
deviceType: "physical",
},
});
await box.action.recording.rewind.enable();
// Perform some operations...
console.info("tapping chrome app...");
await box.action.tap({ target: "chrome app" });
// sleep 3 seconds
console.info("sleeping 3 seconds...");
await new Promise((resolve) => setTimeout(resolve, 3000));
console.info("pressing home button...");
await box.action.pressButton({ buttons: ["home"] });
console.info("extracting recording...");
// Extract the last 5 seconds of the recording
const result = await box.action.recording.rewind.extract({
duration: "5s",
});
console.log(`recording download url: ${result.presignedUrl}`);
}
main();import os
import time
from gbox_sdk import GboxSDK
gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"]) # This is the default and can be omitted
def main():
box = gbox_sdk.create(
type="android",
config={
"device_type": "physical"
}
)
box.action.recording.rewind.enable()
# Perform some operations...
print("tapping chrome app...")
box.action.tap(target="chrome app")
# sleep 3 seconds
print("sleeping 3 seconds...")
time.sleep(3)
print("pressing home button...")
box.action.press_button(buttons=["home"])
print("extracting recording...")
# Extract the last 5 seconds of the recording
result = box.action.recording.rewind.extract(duration="5s")
print(f"recording download url: {result.presigned_url}")
if __name__ == "__main__":
main()curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/actions/recording/rewind/extract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"duration": "10s"
}
'{
"storageKey": "storage://gbox/recording/1234567890",
"presignedUrl": "https://gbox.ai/api/v1/boxes/1234567890/recording/1234567890"
}Authorizations
Enter your API Key in the format: Bearer . Get it from https://gbox.ai
Path Parameters
Box ID
"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"
Body
Configuration for rewinding and extracting clips from continuous screen recording
How far back in time to rewind for extracting recorded video. This specifies the duration to go back from the current moment (e.g., '30s' rewinds 30 seconds to get recent recorded activity). Default is 30s, max is 5m.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: "500ms", "30s", "5m", "1h" Maximum allowed: 5m
"10s"
Response
Result of extracting the recording rewind
Storage key of the recording. Before the box is deleted, you can use this storageKey with the endpoint box/:boxId/storage/presigned-url to get a downloadable URL for the recording.
"storage://gbox/recording/1234567890"
Presigned URL of the recording. This is a temporary downloadable URL with an expiration time for accessing the recording file.
"https://gbox.ai/api/v1/boxes/1234567890/recording/1234567890"
Was this page helpful?