diff --git a/src/components/postElements/body/view/commentBodyView.tsx b/src/components/postElements/body/view/commentBodyView.tsx index 3206d6a1e..bf7b79d29 100644 --- a/src/components/postElements/body/view/commentBodyView.tsx +++ b/src/components/postElements/body/view/commentBodyView.tsx @@ -28,6 +28,7 @@ import { OptionsModal } from '../../../atoms'; import { useAppDispatch } from '../../../../hooks'; import { isCommunity } from '../../../../utils/communityValidation'; import { GLOBAL_POST_FILTERS_VALUE } from '../../../../constants/options/filters'; +import { startsWith } from 'core-js/core/string'; const WIDTH = Dimensions.get('window').width; @@ -53,6 +54,7 @@ const CommentBody = ({ const [revealComment, setRevealComment] = useState(reputation > 0 && !isMuted); const [videoUrl, setVideoUrl] = useState(null); const [youtubeVideoId, setYoutubeVideoId] = useState(null) + const [videoStartTime, setVideoStartTime] = useState(0); const intl = useIntl(); const actionImage = useRef(null); @@ -264,9 +266,10 @@ const CommentBody = ({ } }; - const _handleYoutubePress = (videoId) => { + const _handleYoutubePress = (videoId, startTime) => { if (videoId && youtubePlayerRef.current) { setYoutubeVideoId(videoId); + setVideoStartTime(startTime); youtubePlayerRef.current.setModalVisible(true); } }; @@ -274,6 +277,7 @@ const CommentBody = ({ const _handleVideoPress = (embedUrl) => { if (embedUrl && youtubePlayerRef.current) { setVideoUrl(embedUrl); + setVideoStartTime(0) youtubePlayerRef.current.setModalVisible(true); } }; @@ -364,7 +368,7 @@ const CommentBody = ({ setVideoUrl(null); }} > - + ); diff --git a/src/components/postHtmlRenderer/postHtmlRenderer.tsx b/src/components/postHtmlRenderer/postHtmlRenderer.tsx index 31e4e8fa8..03ea32e3f 100644 --- a/src/components/postHtmlRenderer/postHtmlRenderer.tsx +++ b/src/components/postHtmlRenderer/postHtmlRenderer.tsx @@ -9,7 +9,7 @@ import { AutoHeightImage } from "../autoHeightImage/autoHeightImage"; interface PostHtmlRendererProps { contentWidth:number; body:string; - onLoaded:()=>void; + onLoaded?:()=>void; setSelectedImage:(imgUrl:string)=>void; setSelectedLink:(url:string)=>void; onElementIsImage:(imgUrl:string)=>void; @@ -17,7 +17,7 @@ interface PostHtmlRendererProps { handleOnUserPress:(username:string)=>void; handleTagPress:(tag:string, filter?:string)=>void; handleVideoPress:(videoUrl:string)=>void; - handleYoutubePress:(videoId:string)=>void; + handleYoutubePress:(videoId:string, startTime:number)=>void; } export const PostHtmlRenderer = memo(({