媒体源Api不适用于自定义webm文件(Chrome版本23.0.1271.97米) [英] Media Source Api not working for a custom webm file (Chrome Version 23.0.1271.97 m)
问题描述
我指的是此链接上给出的媒体源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异常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开发渠道版本(即Chrome 25或更高版本)中,您可以通过以下步骤进行验证。
In Chrome dev-channel builds (ie Chrome 25 or later), you can verify this with the following steps.
- 在另一个标签页中打开chrome:media-internals。
- 返回带有测试页的标签页并重新加载。
- 当再次出现错误时,切换回chrome:media-internals选项卡并查找Active media players:标题下的底部条目。它应该具有相同的blob:您传递给视频元素src属性的URL。
- 单击blob:URL以展开播放器数据。
- 点击Log:条目以显示玩家日志数据。
- 在Event:列中搜索具有MEDIA_SOURCE_ERROR的条目。这些条目应该提供有关传递给浏览器的内容的错误信息。
- Open chrome:media-internals in another tab.
- Return to the tab with your test page and reload it.
- When the error occurs again, switch back to chrome:media-internals tab and look for the bottom entry under the "Active media players:" header. It should have the same blob: URL that you passed to the video element src attribute.
- Click on the blob: URL to expand the player data.
- Click on the "Log:" entry to expose the player logging data.
- Search for entries that have "MEDIA_SOURCE_ERROR" in the "Event:" column. These entries should provide information about what is wrong with the content passed to the browser.
如果您看到一条消息,媒体细分并非以关键帧开始。那么这意味着您的文件具有不以关键帧开头的群集。这与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:
- 运行 WebM自适应流式传输指南
- 运行我编写的mse_webm_remuxer程序,作为我的 mse-tools 项目的一部分。
- Run the sample_muxer program mentioned in section 2.2.5 of the WebM adaptive streaming guide
- Run the mse_webm_remuxer program I wrote as part of my mse-tools project.
这篇关于媒体源Api不适用于自定义webm文件(Chrome版本23.0.1271.97米)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!