Meeting archive SDK methods and data
Replay is independent of joining a meeting. Your backend first calls POST /api/v2/rtc/rooms/{roomId}/recordings/access for a short-lived archive ticket. view reads catalogs/events, play reads media, and download retrieves files, attachments, and ZIPs. The ticket is bound to a room and its issuing account/session or API token; the server checks the original grant again on every use. An in-meeting RTC token cannot replace it.
import { AkRtcArchiveClient, rtcArchiveSpeakers } from '@akstream/rtc-web-sdk'
const archive = new AkRtcArchiveClient({
baseUrl: serviceOrigin,
accessProvider: (roomId, action) => businessBackend.issueArchiveAccess(roomId, action)
})
const page = await archive.queryRecordings(roomId, { page: 1, pageSize: 20 })
const run = page.items[0]
if (run) {
const manifest = await archive.getManifest(roomId, run.recordingId, { afterSequence: 0, maxEvents: 1000 })
console.log(rtcArchiveSpeakers(manifest.events, 20000))
}
serviceOrigin is the HTTPS service origin. The host implements businessBackend.issueArchiveAccess and returns {token,roomId,actions,expiresAtUtc}. Never send a long-lived ak_pat_ token to an app or persist a media URL as permanent business data.
Web/H5 AkRtcArchiveClient
| Method | Input | Return | Grant and edge case |
|---|---|---|---|
new AkRtcArchiveClient({baseUrl,accessProvider,fetchImpl?}) |
Origin, ticket provider keyed by room/action, optional fetch | Archive client | May be created after leave. Provider must renew expired tickets. |
queryRecordings(roomId, filters?) |
search, participantId, deviceSessionId, state, fromUtc/toUtc, page/pageSize |
{total,page,pageSize,items} |
view; time filters apply to run start. Access filtering precedes count and paging. |
getManifest(roomId, recordingId, {afterSequence?,maxEvents?}) |
Room, run, event cursor and page limit | RtcArchiveManifest |
view; media and events share one origin. Follow hasMoreEvents/nextSequence. |
listFullExports(roomId, recordingId) |
Room and run ID | Full-export jobs | view; Pending/Running has no playable result yet. |
getMediaResource(roomId, recordingId, fileId) |
Media file belonging to this run | {url,expiresAtUtc} |
play; player URL supports HTTP Range. Reissue ticket/URL after expiry. |
getDownloadResource(roomId, recordingId, fileId) |
Same file | Authorized download URL and expiry | download; a play URL is not download authorization. |
getAttachmentResource(roomId, recordingId, attachmentId, download?) |
Attachment; download=true selects download |
Preview/download URL | Preview requires view, download requires download. Only publicly referenced items in this run are accessible. |
getWhiteboardImageResource(roomId, recordingId, attachmentId) |
Board image in this run | Preview URL | view; knowing an ID does not expose a direct message or another room's image. |
getPackageResource(roomId, recordingId) |
Room and run ID | Archive ZIP URL | download; excludes private chat. |
getFullExportResource(roomId, recordingId, exportId, download?) |
Export ID and play/download choice | MP4 URL and expiry | Play needs play, download needs download; export must be ready. |
rtcArchiveDeviceKey(participantId, deviceSessionId?) builds a device-level view key. rtcArchiveSpeakers(events, positionMilliseconds) returns speaking {participantId,deviceSessionId} pairs at a playback time. Read all relevant pages first. RtcArchiveSpeakerTimeline(events).at(positionMilliseconds) supports seeking and speed changes; these functions replay activity events and do not identify speakers from audio.
Reading the response model
| Field | Meaning | Common mistake |
|---|---|---|
recordingId, roomId |
One run and its meeting | A room can have multiple runs; room ID is not a file ID. |
originAtUtc, durationMilliseconds |
UTC timeline origin and total length | offsetMilliseconds is relative to this origin, not page load time. |
tracks[] |
Original media per participant device | Distinguish participantId + deviceSessionId + mediaKind; a rejoin can add tracks. |
tracks[].files[] |
File ID, offset, duration, play/download URLs | Muted or disconnected intervals may have no media; do not freeze an old frame. |
composites[] |
Post-meeting member/screen playback copy | A Pending/Failed copy does not delete original tracks. |
events[], hasMoreEvents, nextSequence |
Paged chat, board, control, and speaker events | Keep paging when hasMoreEvents; server applies private visibility. |
speakerActivityVersion |
Speaker-event format | Display unknown on old runs lacking events instead of inventing a speaker. |
Android, iOS, and UniApp equivalents
| Platform | Construction/renewal | Query | Resources/results |
|---|---|---|---|
| Android | AkRtcArchiveClient(baseUrl, accessJson, okHttpClient); renew with setAccess(JSONObject) |
queryRecordings(roomId, filters, Callback), getManifest(roomId, recordingId, afterSequence, maxEvents, Callback), listFullExports(..., Callback) |
getMediaResource/getDownloadResource/getAttachmentResource/getWhiteboardImageResource/getPackageResource/getFullExportResource return a URL/expiry JSONObject; network failures include HTTP status. |
| iOS | try AkRtcArchiveClient(baseURL:access:session:); setAccess(_:) |
queryRecordings(roomId:filters:), getManifest(roomId:recordingId:afterSequence:maxEvents:), listFullExports(roomId:recordingId:) use async throws |
Matching resource methods return RtcArchiveResource {url,expiresAtUtc}; RtcArchiveError.status carries HTTP status. |
| UniApp | createUniArchiveClient({baseUrl,accessProvider}) |
Reuses the Web archive client's queries and manifest | Native UTS requestRtcArchive(serverUrl,accessJson,action,payloadJson,callback) accepts query/manifest/fullExports/media/download/package/fullExportMedia/fullExportDownload/whiteboardImage/attachmentPreview/attachmentDownload. |
Android/iOS setAccess replaces the held short-lived ticket; it does not decide who may view a meeting. The host obtains a new grant from its backend. Native resource methods return addresses, not player/download UI.
Failures and replay boundaries
| Condition | Action |
|---|---|
| 401 | Ticket expired or its issuing login/API token was revoked. Request a fresh archive ticket, not an in-meeting token. |
| 403 | Required view/play/download action or meeting grant is missing. Stop retries and request access. |
| 404 | Run, file, or attachment does not belong to this room or visible run interval. Refresh the manifest. |
| 415 | Format is not previewable in the site. Use the download action only when granted. |
Stopping, Pending, Running |
Run/copy/export is finalizing. Keep status and poll; do not invent a file link. |
See the RTC archive HTTP API for backend ticket issuance and exact paths.