post detail view now support start time passing

This commit is contained in:
noumantahir 2022-01-15 23:00:01 +05:00
parent d651fb06ad
commit 135d774b49

View File

@ -32,6 +32,7 @@ const PostBody = ({ navigation, body, dispatch, onLoadEnd }) => {
const [html, setHtml] = useState('');
const [youtubeVideoId, setYoutubeVideoId] = useState(null);
const [videoUrl, setVideoUrl] = useState(null);
const [videoStartTime, setVideoStartTime] = useState(0);
const intl = useIntl();
const actionImage = useRef(null);
@ -44,9 +45,10 @@ const PostBody = ({ navigation, body, dispatch, onLoadEnd }) => {
}
}, [body]);
const _handleYoutubePress = (videoId) => {
const _handleYoutubePress = (videoId, startTime) => {
if (videoId && youtubePlayerRef.current) {
setYoutubeVideoId(videoId);
setVideoStartTime(startTime);
youtubePlayerRef.current.setModalVisible(true);
}
};
@ -54,6 +56,7 @@ const PostBody = ({ navigation, body, dispatch, onLoadEnd }) => {
const _handleVideoPress = (embedUrl) => {
if (embedUrl && youtubePlayerRef.current) {
setVideoUrl(embedUrl);
setVideoStartTime(0);
youtubePlayerRef.current.setModalVisible(true);
}
};
@ -291,7 +294,11 @@ const PostBody = ({ navigation, body, dispatch, onLoadEnd }) => {
setVideoUrl(null);
}}
>
<VideoPlayerSheet youtubeVideoId={youtubeVideoId} videoUrl={videoUrl} />
<VideoPlayerSheet
youtubeVideoId={youtubeVideoId}
videoUrl={videoUrl}
startTime={videoStartTime}
/>
</ActionSheetView>
<OptionsModal