Props:
any** props: Props from the HTML Iframe.Global Variables:
none.
Local Variables:
none.
Purpose:
This component specifically renders youtube videos in articles. It copies the parameters from what was included in the original wordpress post, and displays it using WebView.
Source Code:
const YoutubeRenderer = (props) => {
const iframeProps = useHtmlIframeProps(props);
const videoId = iframeProps.htmlAttribs['data-videoid'];
// Copying link params from Wordpress embeds
const videoUrl = `https://www.youtube.com/embed/${videoId}?enablejsapi=1&=1&rel=1&showsearch=0&showinfo=1&iv_load_policy=1&fs=1&hl=en-US&autohide=2&wmode=transparent&playsinline=1`;
if (videoId) iframeProps.source = { uri: videoUrl };
return iframeProps ? <WebView {...iframeProps} style={{ height: 200 }} scrollEnabled={false} useWebKit /> : null;
};