Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Video Unavailable problem at YouTube preview #26980

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,14 @@ exports[`YoutubeVideo should match snapshot for playing state 1`] = `
onClick={[Function]}
>
<iframe
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowFullScreen={true}
frameBorder="0"
height="360px"
referrerPolicy="strict-origin-when-cross-origin"
sandbox="allow-scripts allow-same-origin allow-popups allow-presentation"
src="https://www.youtube.com/embed/xqCoNej8Zxo?autoplay=1&autohide=1&border=0&wmode=opaque&fs=1&enablejsapi=1"
title="Youtube title"
width="480px"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default class YoutubeVideo extends React.PureComponent<Props, State> {
const {metadata, link} = this.props;

const videoId = getVideoId(link);
const videoTitle = metadata?.title || 'unknown';
const time = handleYoutubeTime(link);

const header = (
Expand All @@ -59,7 +60,7 @@ export default class YoutubeVideo extends React.PureComponent<Props, State> {
href={this.props.link}
location='youtube_video'
>
{metadata?.title || 'unknown'}
{videoTitle}
</ExternalLink>
</span>
</h4>
Expand All @@ -75,6 +76,10 @@ export default class YoutubeVideo extends React.PureComponent<Props, State> {
height='360px'
frameBorder='0'
allowFullScreen={true}
allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'
referrerPolicy='strict-origin-when-cross-origin'
title={videoTitle}
sandbox='allow-scripts allow-same-origin allow-popups allow-presentation'
/>
);
} else {
Expand Down