Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(calls): extend recording link expiry to six hours (#6672)

teo34ae55562a91
diff --git a/apps/web/src/features/block-call/component/CallRecording/CallRecordingVideo.test.tsx b/apps/web/src/features/block-call/component/CallRecording/CallRecordingVideo.test.tsx
index 53bec35295..2993da2798 100644
--- a/apps/web/src/features/block-call/component/CallRecording/CallRecordingVideo.test.tsx
+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingVideo.test.tsx
@@ -22,7 +22,6 @@ const nextRecordingUrl =
const posterUrl =
'https://recordings.example/previews/call-1.jpg?signature=abc';
const posterBlobUrl = 'blob:call-recording-preview';
-const mediaErrSrcNotSupported = 4;
const originalCreateObjectUrl = Object.getOwnPropertyDescriptor(
URL,
@@ -64,10 +63,10 @@ function getVideo(container: HTMLElement): HTMLVideoElement {
return video;
}
-function dispatchUnsupportedMediaError(video: HTMLVideoElement): void {
+function dispatchMediaError(video: HTMLVideoElement, code: number): void {
Object.defineProperty(video, 'error', {
configurable: true,
- value: { code: mediaErrSrcNotSupported },
+ value: { code },
});
video.dispatchEvent(new Event('error'));
}
@@ -95,53 +94,54 @@ afterAll(() => {
});
describe('CallRecordingVideo', () => {
- it('shows an unsupported-format fallback while preserving native video attributes', async () => {
- mockPosterFetch();
-
- const { container } = render(() => (
- <CallRecordingVideo url={recordingUrl} posterUrl={posterUrl} />
- ));
- const video = getVideo(container);
-
- expect(video.load).toHaveBeenCalledOnce();
-
- await waitFor(() =>
- expect(video.getAttribute('poster')).toBe(posterBlobUrl)
- );
-
- dispatchUnsupportedMediaError(video);
-
- expect(
- screen.getByText(
- "This recording uses a media format your browser can't play."
- )
- ).not.toBeNull();
-
- const fallbackLink = screen.getByRole('link', {
- name: 'Open or download recording',
- });
- expect(fallbackLink.getAttribute('href')).toBe(recordingUrl);
- expect(fallbackLink.getAttribute('target')).toBe('_blank');
- expect(fallbackLink.getAttribute('rel')).toBe('noopener noreferrer');
- expect(fallbackLink.hasAttribute('download')).toBe(true);
-
- expect(video.hasAttribute('controls')).toBe(true);
- expect(video.getAttribute('preload')).toBe('metadata');
- expect(video.getAttribute('crossorigin')).toBe('anonymous');
- expect(video.getAttribute('poster')).toBe(posterBlobUrl);
- expect(video.getAttribute('src')).toBe(recordingUrl);
-
- video.dispatchEvent(new Event('canplay'));
-
- expect(screen.queryByRole('alert')).toBeNull();
- });
+ it.each([2, 3, 4])(
+ 'shows a playback fallback for media error %s while preserving native video attributes',
+ async (code) => {
+ mockPosterFetch();
+
+ const { container } = render(() => (
+ <CallRecordingVideo url={recordingUrl} posterUrl={posterUrl} />
+ ));
+ const video = getVideo(container);
+
+ expect(video.load).toHaveBeenCalledOnce();
+
+ await waitFor(() =>
+ expect(video.getAttribute('poster')).toBe(posterBlobUrl)
+ );
+
+ dispatchMediaError(video, code);
+
+ expect(
+ screen.getByText("This recording couldn't be played.")
+ ).not.toBeNull();
+
+ const fallbackLink = screen.getByRole('link', {
+ name: 'Open or download recording',
+ });
+ expect(fallbackLink.getAttribute('href')).toBe(recordingUrl);
+ expect(fallbackLink.getAttribute('target')).toBe('_blank');
+ expect(fallbackLink.getAttribute('rel')).toBe('noopener noreferrer');
+ expect(fallbackLink.hasAttribute('download')).toBe(true);
+
+ expect(video.hasAttribute('controls')).toBe(true);
+ expect(video.getAttribute('preload')).toBe('metadata');
+ expect(video.getAttribute('crossorigin')).toBe('anonymous');
+ expect(video.getAttribute('poster')).toBe(posterBlobUrl);
+ expect(video.getAttribute('src')).toBe(recordingUrl);
+
+ video.dispatchEvent(new Event('canplay'));
+
+ expect(screen.queryByRole('alert')).toBeNull();
+ }
+ );
it('clears the fallback when the recording URL changes', async () => {
const [url, setUrl] = createSignal(recordingUrl);
const { container } = render(() => <CallRecordingVideo url={url()} />);
const video = getVideo(container);
- dispatchUnsupportedMediaError(video);
+ dispatchMediaError(video, 4);
expect(screen.getByRole('alert')).not.toBeNull();
setUrl(nextRecordingUrl);
diff --git a/apps/web/src/features/block-call/component/CallRecording/CallRecordingVideo.tsx b/apps/web/src/features/block-call/component/CallRecording/CallRecordingVideo.tsx
index 2e0eb833ea..66d873b2c3 100644
--- a/apps/web/src/features/block-call/component/CallRecording/CallRecordingVideo.tsx
+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingVideo.tsx
@@ -143,12 +143,10 @@ export function CallRecordingVideo(props: {
role="alert"
class="w-full max-w-lg rounded border border-alert/30 bg-alert-bg px-3 py-2 text-sm text-alert-ink"
>
- <p class="font-medium">
- This recording uses a media format your browser can't play.
- </p>
+ <p class="font-medium">This recording couldn't be played.</p>
<p class="mt-1 text-alert-ink/80">
- You can still open or download the recording to play it in another
- app.
+ Reload the page to try again, or open or download the recording to
+ play it in another app.
</p>
<a
href={props.url}
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 70d4ef899b..aeac627cdc 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -555,6 +555,10 @@ and summaries appear here; empty state notes "Calls are available to agents."
On phones, recorded call headers omit the **Call Again** action.
+If a recording fails to play, reload the page to obtain a fresh recording link,
+or use **Open or download recording**. The playback warning does not assume
+that the failure is caused by an unsupported media format.
+
### Sharing a call
A call's **Share** dialog has a `Team access` control (None or View) for the same canonical
diff --git a/services/document_storage_service/src/config.rs b/services/document_storage_service/src/config.rs
index b4e4768745..4a75de0c4c 100644
--- a/services/document_storage_service/src/config.rs
+++ b/services/document_storage_service/src/config.rs
@@ -5,6 +5,8 @@ use macro_env_var::{env_vars, maybe_env_vars};
use secretsmanager_client::LocalOrRemoteSecret;
pub const DEFAULT_PRESIGNED_URL_EXPIRY_SECONDS: u64 = 900; // 15 minutes
+/// Allow long recordings to play and seek without the signed URL expiring mid-session.
+pub const CALL_RECORDING_PRESIGNED_URL_EXPIRY_SECONDS: u64 = 6 * 60 * 60;
pub const DEFAULT_PRESIGNED_URL_BROWSER_CACHE_EXPIRY_SECONDS: u64 = 840; // remember that this is just a suggestion to the client browser
env_vars! {
@@ -40,7 +42,7 @@ env_vars! {
/// as `COHERE_API_KEY`, following the same pattern as `OPENAI_API_KEY`.
pub struct CohereApiKey;
pub struct DocumentLimit;
- /// Shared signed URL lifetime for document content and call recordings.
+ /// Signed URL lifetime for document content.
pub struct DocumentStorageServicePresignedUrlExpirySeconds;
pub struct DocumentStorageServicePresignedUrlBrowserCacheExpirySeconds;
/// Shared CloudFront signer private key for document content and call recordings.
diff --git a/services/document_storage_service/src/main.rs b/services/document_storage_service/src/main.rs
index e71141a618..34a5ba16db 100644
--- a/services/document_storage_service/src/main.rs
+++ b/services/document_storage_service/src/main.rs
@@ -656,8 +656,7 @@ async fn run() -> anyhow::Result<()> {
.document_storage_service_cloudfront_signer_private_key
.as_ref()
.to_string(),
- presigned_url_expiry_seconds: config
- .document_storage_service_presigned_url_expiry_seconds,
+ presigned_url_expiry_seconds: config::CALL_RECORDING_PRESIGNED_URL_EXPIRY_SECONDS,
};
Some(S3RecordingStorage::new(egress_config.bucket.clone(), cloudfront_config).await)
}