是否铬嵌入式框架支持HTML5音频? [英] Does Chromium Embedded Framework support HTML5 audio?
问题描述
我一直在CefSharp玩弄我似乎可以不作任何音频播放。我可以控制出现的声音,但他们仍然被冻结。
I've been playing around with CefSharp and I can't seem to make any audio play. I can make the audio controls appear, but they remain frozen.
以上是我用的版本:
Chromium: 21.0.1180.0, CEF: r728, CefSharp: 0.12.4596.50
我第一次尝试.MP3,然后.OGG,最后.WAV,但没有人会工作。
I tried first .mp3, then .ogg, and finally .wav, but none would work.
这是.OGG尝试当我加载HTML和音频:
This is the HTML and audio I load when trying with .ogg:
public bool OnBeforeResourceLoad(IWebBrowser browser,
IRequestResponse requestResponse)
{
IRequest request = requestResponse.Request;
if (request.Url.EndsWith(".gif")) {
MemoryStream stream = new MemoryStream();
Properties.Resources.cursor_test.Save(stream,
System.Drawing.Imaging.ImageFormat.Bmp);
requestResponse.RespondWith(stream, "image/gif");
}
else if (request.Url.EndsWith(".ogg")) {
MemoryStream stream = new MemoryStream(Properties.Resources.foo);
requestResponse.RespondWith(stream, "audio/ogg");
}
else {
Stream resourceStream = new MemoryStream(Encoding.UTF8.GetBytes(
@"<!DOCTYPE html>
<html>
<body>
<img src=""bla1/bla2/foo.gif"" />
<audio controls=""controls"" autoplay=""autoplay"">
<source src=""foo.ogg"" />
</audio>
</body>
</html>"));
requestResponse.RespondWith(resourceStream, "text/html");
}
return false;
}
这是铬的样子:
我看了,也许与铬只开放格式的支持。我也看了也许音频仅仅是不适用于现在一>
I read that perhaps with Chromium only open formats are supported. I also read the perhaps audio is just not available for now.
什么是当前的状态&LT;音频/&GT;
中的铬和CEF
What is the current state of <audio />
in Chromium and CEF?
推荐答案
默认情况下,MP3音频的支持是出于法律原因禁用。
可以通过重建CEF启用它。查看详情这里:
<一href=\"http://stackoverflow.com/questions/8033495/chromium-embedded-framework-mp3-support/12354577\">Chromium嵌入式框架支持MP3
By default, the support for MP3 audio is disabled for legal reasons.
You can enable it by rebuilding CEF. See the details here:
Chromium Embedded Framework MP3 support
这篇关于是否铬嵌入式框架支持HTML5音频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!