Skip to content

Commit

Permalink
Merge pull request #37066 from bernhardoj/fix/36899-video-preview-lea…
Browse files Browse the repository at this point in the history
…ds-to-not-found-page

Fix opening video preview leads to not found page

(cherry picked from commit e62c98d)
  • Loading branch information
stitesExpensify authored and OSBotify committed Feb 23, 2024
1 parent 9c85621 commit ed34831
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import type {CustomRendererProps, TBlock} from 'react-native-render-html';
import {ShowContextMenuContext} from '@components/ShowContextMenuContext';
import VideoPlayerPreview from '@components/VideoPlayerPreview';
import * as FileUtils from '@libs/fileDownload/FileUtils';
import {parseReportRouteParams} from '@libs/ReportUtils';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import Navigation from '@navigation/Navigation';
import CONST from '@src/CONST';
Expand All @@ -22,22 +22,24 @@ function VideoRenderer({tnode, key}: VideoRendererProps) {
const width = Number(htmlAttribs[CONST.ATTACHMENT_THUMBNAIL_WIDTH_ATTRIBUTE]);
const height = Number(htmlAttribs[CONST.ATTACHMENT_THUMBNAIL_HEIGHT_ATTRIBUTE]);
const duration = Number(htmlAttribs[CONST.ATTACHMENT_DURATION_ATTRIBUTE]);
const activeRoute = Navigation.getActiveRoute();
const {reportID} = parseReportRouteParams(activeRoute);

return (
<VideoPlayerPreview
key={key}
videoUrl={sourceURL}
fileName={fileName}
thumbnailUrl={thumbnailUrl}
videoDimensions={{width, height}}
videoDuration={duration}
onShowModalPress={() => {
const route = ROUTES.REPORT_ATTACHMENTS.getRoute(reportID, sourceURL);
Navigation.navigate(route);
}}
/>
<ShowContextMenuContext.Consumer>
{({report}) => (
<VideoPlayerPreview
key={key}
videoUrl={sourceURL}
fileName={fileName}
thumbnailUrl={thumbnailUrl}
videoDimensions={{width, height}}
videoDuration={duration}
onShowModalPress={() => {
const route = ROUTES.REPORT_ATTACHMENTS.getRoute(report?.reportID ?? '', sourceURL);
Navigation.navigate(route);
}}
/>
)}
</ShowContextMenuContext.Consumer>
);
}

Expand Down

0 comments on commit ed34831

Please sign in to comment.