You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel 8中CKEditor5插入的YouTube链接前端无法显示求助

CKEditor5生成oEmbed标签前端无法渲染,如何替换为可用的iframe/video标签?

运行环境

  • Laravel 8
  • jQuery 3.6
  • CKEditor5

问题现象

后台点击工具栏默认的「插入媒体」按钮,粘贴YouTube链接后,CKEditor5编辑器内可正常预览视频,但前端页面无法渲染该视频内容。

前端Blade模板代码

<div class="news-view-content">
    {!! $news->content !!}
    <hr>
    <hr>
    <hr>
    {{ $news->content }}
</div>

CKEditor5输出的内容文本

<figure class="media">
    <oembed url="https://www.youtube.com/watch?v=hufhhf2MSHU"></oembed>
</figure>

验证情况

测试发现,直接使用iframe标签嵌入YouTube视频、video标签展示本地上传视频,均可在前端正常显示:

YouTube视频可用代码示例

<iframe
    src="https://www.youtube.com/embed/key"
    title="_you_tubevideoplayer" frameborder="0"
    allow="accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture;web-share" allowfullscreen>
</iframe>

本地视频可用代码示例

<video controls preload="auto"
    class="news-videovideo-jsnews_video_playervjs-theme-forest"
    data-setup='{}' type="video/x-msvideo">
    <source src="http://127.0.0.1:8000/storage/160/sample.avi">
</video>

疑问

能否将CKEditor5默认生成的oEmbed标签替换为上述可用的iframe或video标签?需要更换插件或进行哪些设置才能让视频在前端正常显示?


内容的提问来源于stack exchange,提问作者mstdmstd

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 17:40:10