in the objects "attributes" section add this declaration, I named mine videoURL:
videoURL: {
type: 'string',
source: 'attribute',
selector: 'iframe',
attribute: 'src',
}
then in the "edit" section add this (and dont' forget to add videoURL declaration to your attributes object in the edit section )
const onChangeVideoURL = (value) => {
setAttributes({ videoURL: value });
};
now return this block of code in the "return" section of the "edit" block - note the "src" for video:
<h3>{__('Link to video', 'In the Media')}</h3>
<RichText
tagName="div"
multiline="iframe"
src={videoURL}
className="wp-block-embed is-type-video is-provider-youtube"
placeholder={__(
'Link to video url',
'In the Media'
)}
value={videoURL}
onChange={onChangeVideoURL}
/>
then in the "save" section add this block of code (don't forget to add your declared videoURL to the attributes object):
<h3>{__('Video Link', 'gutenberg-examples')}</h3>
<RichText.Content
tagName="iframe"
className="video"
value={videoURL}
src={videoURL}
/>
I'm using the YT url with the "embed" option in the url, as in "https://www.youtube.com/embed/-----"