我一直在玩 CefSharp,但似乎无法播放任何音频。我可以让音频控件出现,但它们仍然冻结。
这些是我使用的版本:
Chromium: 21.0.1180.0, CEF: r728, CefSharp: 0.12.4596.50
我首先尝试了 .mp3,然后是 .ogg,最后是 .wav,但没有一个可以工作。
这是我尝试使用 .ogg 时加载的 HTML 和音频:
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;
}
这就是 Chromium 的样子:
我读到也许 Chromium只支持开放格式。我还阅读了也许音频暂时不可用。
<audio />
Chromium 和 CEF的当前状态是什么?