I know that this has been asked many times, but I open this discussion to solve my problem and to summarize all we know about this topic to help people in the future.
So, let's go. We want to upload a video (e.g. from YouTube). We can do this pasting the video url or using the MediaEmbed button.
We have two possibility.
We can set or not in our editorConfig
mediaEmbed: { previewsInData: true }
WITHOUT previewsInData: true
we obtain something like this:
<figure class="media">
<oembed url="https://www.youtube.com/watch?v=something"></oembed>
</figure>
Instead WITH previewsInData: true
we obtain something like this
<figure class="media">
<div data-oembed-url="https://www.youtube.com/watch?v=vsl3gBVO2k4&ab_channel=H%C3%A9lderPalma">
<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;">
<iframe src="https://www.youtube.com/embed/vsl3gBVO2k4" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen="">
</iframe>
</div>
</div>
</figure>
In both cases i'm able to see the preview of the youtube video in my CKEditor. But when I save the content of the editor and I get that to display it in my presentation page the video is not displayed.
Reading the other discussions here on the forum I couldn't figure out if this is just my problem or not. Many solutions concerning adding previewsInData: true
in editorConfig, but for me absolutely nothing changes.
I think that the tag figure
and the oembed div
is useful to CKEditor to display a preview of the video. We know that this preview is like a picture, you can't play the video, you can't open in a new page, etc. This is ok, but i want to see the video in my presentation page.
So, where is the problem?
- Is there something to change on the presentation page to have the video displayed?
- Should I search for the figure tag and replace it with an iframe server side?
- Any ideas?
I hope we can find a permanent solution to this problem.