What is the name of the domain?
Type
Live Streaming
What is the issue you’re encountering
need api or sdk support for the video recorded get back after stream
What steps have you taken to resolve the issue?
I have made the new stream via cloudflare sdk and streamed via obs Rtmps and made about 3-4 min video. then when i want the video recorded to be played back on the element i need the video recorded id. so i checked the docs and went through this Record and replay live streams · Cloudflare Stream docs and made my code api for this as it dont have sdk support . async getSinglestream(id: string) {
try {
const url = https://dash.cloudflare.com/api/v4/accounts/${this.accountid}/stream/live_inputs/${id}/videos
;
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${this.configService.get<string>('cldflaretoken')}`, // Include the API token
},
});
console.log(this.accountid)
console.log(this.configService.get<string>('cldflaretoken'))
console.log(response)
if (!response.ok) {
const error = await response.json();
throw new Error(`Failed to fetch videos: ${error.errors || response.statusText}`);
}
const data = await response.json();
// Return the video list
return data.result; // `result` contains the videos array in Cloudflare's API response
} catch (error) {
console.error('Error fetching video recordings:', error.message);
throw new Error('Failed to fetch video recordings for the live input');
}
} the error i get is this respone as Response {
status: 403,
statusText: ‘Forbidden’,
headers: Headers {
date: ‘Thu, 09 Jan 2025 08:47:41 GMT’,
‘content-type’: ‘text/html; charset=UTF-8’,
‘transfer-encoding’: ‘chunked’,
connection: ‘keep-alive’,
‘x-frame-options’: ‘SAMEORIGIN’,
‘referrer-policy’: ‘same-origin’,
‘cache-control’: ‘max-age=15’,
expires: ‘Thu, 09 Jan 2025 08:47:56 GMT’,
‘set-cookie’: ‘__cf_bm=f9KUJifap_rP8AB_NuvmtdvOIQ4q8QNuuUn07VimmJ4-1736412461-1.0.1.1-ERmuhQ5TerO23cYLVo8oTVcK.05yrHId6jx38pJCxLCN2rPc0DmhxpgnOqCySg6IdFzawxqegLtYbi9ul0Ofrg; path=/; expires=Thu, 09-Jan-25 09:17:41 GMT; domain=.dash.cloudflare.com; HttpOnly; Secure; SameSite=None’,
vary: ‘Accept-Encoding’,
‘strict-transport-security’: ‘max-age=86400; includeSubDomains’,
‘x-content-type-options’: ‘nosniff’,
server: ‘cloudflare’,
‘cf-ray’: ‘8ff329fd1b477f25-MAA’,
‘content-encoding’: ‘gzip’,
‘alt-svc’: ‘h3=“:443”; ma=86400’
},
body: ReadableStream { locked: false, state:
‘readable’, supportsBYOB: true },
bodyUsed: false,
ok: false,
redirected: false,
type: ‘basic’,
url: ‘https://dash.cloudflare.com/api/v4/accounts/myid/stream/live_inputs/d7e31eed8611011d7c9f36c5b2a650d9/videos’
}
Error fetching video recordings: Unexpected token ‘<’, "<!DOCTYPE "… is not valid JSON
[Nest] 19368 - 09/01/2025, 2:17:40 pm ERROR [ExceptionsHandler] Failed to fetch video recordings for the live input