媒体源 Api 不适用于自定义 webm 文件(Chrome 版本 23.0.1271.97 m) [英] Media Source Api not working for a custom webm file (Chrome Version 23.0.1271.97 m)

查看:36
本文介绍了媒体源 Api 不适用于自定义 webm 文件(Chrome 版本 23.0.1271.97 m)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是在这个 link 上给出的媒体源 API 演示

I am referring a media source api demo given on this link

它对于给定的测试 webm 文件工作正常,但是当我尝试将文件名更改为自定义 webm 文件时,代码停止工作.

It is working fine for the given test webm file but when i tried to change the name of the file to a custom webm file the code stopped working.

它正在生成以下错误:未捕获的错误:INVALID_STATE_ERR:DOM Exception 11 在以下代码中:sourceBuffer.append(new Uint8Array(e.target.result));

It is generating following error : Uncaught Error: INVALID_STATE_ERR: DOM Exception 11 at following code : sourceBuffer.append(new Uint8Array(e.target.result));

为了检查自定义 webm 文件是否正常工作,我创建了一个测试页面,我在其中定义了一个具有该自定义 webm 文件源的视频标签.当我运行代码时,它工作正常.

To check whether the custom webm file is working i have created a test page in which i have defined a video tag having source of that custom webm file. When i ran the code it is working fine.

我无法理解这种奇怪行为的原因.

I am unable to understand the reason for this strange behavior.

推荐答案

最有可能的问题是您的 WebM 文件包含不以关键帧开头的集群.

The most likely problem is your WebM file has Clusters that don't start with a keyframe.

在 Chrome dev-channel builds(即 Chrome 25 或更高版本)中,您可以通过以下步骤验证这一点.

In Chrome dev-channel builds (ie Chrome 25 or later), you can verify this with the following steps.

  1. 在另一个标签中打开 chrome:media-internals.
  2. 返回带有测试页的选项卡并重新加载它.
  3. 当错误再次发生时,切换回 chrome:media-internals 选项卡并在Active media player:"标题下查找底部条目.它应该具有您传递给视频元素 src 属性的相同 blob: URL.
  4. 点击 blob: URL 以展开玩家数据.
  5. 点击日志:"条目以显示玩家日志数据.
  6. 在事件:"列中搜索具有MEDIA_SOURCE_ERROR"的条目.这些条目应提供有关传递给浏览器的内容有什么问题的信息.

如果您看到诸如媒体片段未以关键帧开头"之类的消息.那么这意味着您的文件具有不以关键帧开头的集群.这对于 FFmpeg 生成的内容很常见.您可以通过以下方式之一修复您的文件:

If you see a message that says something like "Media segment did not begin with keyframe." then it means your file has Clusters that don't start with a keyframe. This is common with content that is generated by FFmpeg. You can fix your file in one of the following ways:

  1. 运行 WebM 自适应流媒体指南
  2. 运行我在 mse-tools 项目中编写的 mse_webm_remuxer 程序.
  1. Run the sample_muxer program mentioned in section 2.2.5 of the WebM adaptive streaming guide
  2. Run the mse_webm_remuxer program I wrote as part of my mse-tools project.

这篇关于媒体源 Api 不适用于自定义 webm 文件(Chrome 版本 23.0.1271.97 m)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆