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

AEM Dynamic Media视频隐藏字幕无法正常工作问题排查

AEM Dynamic Media VideoViewer 隐藏字幕异常问题排查与解决

可能原因

  • captionUrl 非绝对URL:如果传入的captionUrl是相对路径(如/path/to/caption.vtt或path/to/caption.vtt),VideoViewer会自动拼接当前页面主机名,导致字幕文件路径错误。
  • URL格式或编码问题:caption参数要求格式为[URL],[语言代码],若URL包含特殊字符未编码,会导致播放器解析异常。
  • 服务器MIME类型配置缺失:VTT文件需服务器返回text/vtt类型的响应头,否则播放器可能无法识别加载。

解决方案

  1. 使用完整绝对URL
    确保captionUrl以http://或https://开头,示例代码:

    const captionUrl = "https://your-domain.com/path/to/caption-file.vtt";
    new window.s7viewers.VideoViewer({
      containerId: containerId,
      params: {
        asset: assetName,
        serverurl: serverurl,
        videoserverurl: videoserverurl,
        caption: captionUrl + ',1',
      },
    });
    
  2. 对特殊字符URL编码
    若字幕URL包含空格、中文等特殊字符,用encodeURI()处理后再传入:

    const rawCaptionUrl = "https://your-domain.com/path/to/带特殊字符的字幕.vtt";
    const encodedCaptionUrl = encodeURI(rawCaptionUrl);
    new window.s7viewers.VideoViewer({
      containerId: containerId,
      params: {
        asset: assetName,
        serverurl: serverurl,
        videoserverurl: videoserverurl,
        caption: encodedCaptionUrl + ',1',
      },
    });
    
  3. 验证VTT文件可访问性
    直接在浏览器中访问字幕的绝对URL,确认文件能正常加载;同时检查服务器响应头,确保Content-Type为text/vtt。

  4. 排查SDK版本兼容性
    当前使用的SDK版本为3.5,可尝试升级至最新稳定版本,确认是否存在已知的字幕路径解析bug。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.14 08:27:12