您可以推荐什么工具链来编写嵌入网络浏览器的自定义多媒体播放器?
我要编写一个自定义多媒体播放器。它将嵌入到 Web 浏览器中,并通过 SSL 连接从服务器接收数据。
所需的功能是:
- MPEG4 视频和不同的 VoIP 音频解码(例如 G.711 或 G.729)
- 自定义控制
- 波形表示(或只是灵活的绘图 API)
我想到 Adobe Flash(或 Flex)。但我对这项技术知之甚少。我最关心的是多媒体解码。
您能为这个项目推荐 Adobe Flex 或其他任何东西吗?在此过程中我会遇到哪些陷阱?
编辑:
Flash Player 不支持 MPEG4 或 VoIP 音频编解码器。因此,要使用 Flash,我需要设置多媒体流服务器并将媒体转码为支持的格式(H.264/AAC)。这是一个比我预期的成本更高的解决方案。
我应该考虑哪些替代方案? Java 小程序?活动X? Windows 媒体播放器?
I'm going to write a custom multimedia player. It will be embedded into a web-browser and will receive data from a server over SSL connection.
Required functionality is:
- MPEG4 video and different VoIP audio decoding (e.g. G.711 or G.729)
- custom controls
- waveform representation (or just flexible drawing API)
I think about Adobe Flash (or Flex). But I know little about this technology. My biggest concern is multimedia decoding.
Can you recommend Adobe Flex or anything else for this project? What pitfalls can I expect on this way?
EDIT:
Flash Player doesn't support MPEG4 or VoIP audio codecs. So to use Flash I need to setup multimedia streaming server and transcode my media to supported formats (H.264/AAC). It's much more costly solution than I expected.
What alternatives should I review? Java applet? ActiveX? Windows Media Player?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
嗯,您可以使用 Silverlight 来完成此操作; Silverlight 具有允许您向其提供原始 H.264 帧的接口,并且它将显示它们。事实上,Netflix 的在线流媒体视频播放器是用 silverlight 编写的。如果这有效,这可能是您最好的选择。
如果这不起作用,并且 Flash 无法做到这一点,那么您可以尝试 java (不太了解这是否可行,但我的猜测是许多客户端计算机上缺乏 java将是一个障碍)或编写您自己的插件/activex 控件。
除了繁重的学习曲线之外,ActiveX 控件的主要挑战是您必须以某种方式将其安装在客户端计算机上。当您谈论媒体播放器时,这甚至更加棘手,因为那时您可能需要处理声音驱动程序和视频渲染;要渲染高质量视频,您需要使用硬件加速,这意味着 directx 和/或 opengl(假设您的目标是 Windows)。此外,ActiveX 控件仅适用于 IE,不适用于任何其他 Web 浏览器。
但是,如果您确实选择使用插件/activex 路线,我强烈建议您查看 FireBreath; FireBreath 是一个浏览器插件框架和抽象,用于编写跨平台和跨浏览器插件。 Flash 和 Silverlight 本身就是 activex 控件和 npapi 插件,而且我知道至少有两个专门使用 FireBreath 编写的媒体播放器。这将是从插件角度解决问题的最简单方法,但您必须使用 C++。不要误会我的意思——即使使用 FireBreath,这也不是一件容易的任务,但至少它解决了在浏览器中托管的许多最棘手的部分。
插件的主要优点是你几乎可以做任何事情——使用硬件渲染、访问文件系统等。这是最灵活的选项。插件的主要缺点是你几乎可以做任何事情——使浏览器崩溃、删除文件、如果你不小心就会打开安全漏洞等等。
我想最后的选择是使用 ajax 请求,执行在 javascript 中解码,并在 Chrome 中渲染到网络画布,但我猜这仍然不太现实 =]
祝你好运,希望有所帮助。
Well, you could possibly do this using Silverlight; Silverlight has interfaces that allow you to give it raw H.264 frames and it will display them. In fact, netflix's online streaming video player is written in silverlight. If that will work, it may be your best bet.
If that doesn't work, and Flash won't do it, then you could possibly try java (don't know enough to know if that would be doable or not, but my guess is that the lack of java on many client machines would be a barrier) or write your own plugin/activex control.
The primary challenge with an ActiveX control, aside from the heavy learning curve, is that you have to somehow install it on client machines. This is even more tricky when you're talking about a media player, because then you'll probably need to deal with sound drivers and video rendering; to render high quality video you'll want to use hardware acceleration, which means directx and/or opengl, assuming you're targetting windows. Also, an ActiveX control only works on IE, not on any of the other web browsers.
However, if you do choose to go the plugin/activex route, I highly recommend that you look at FireBreath; FireBreath is a browser plugin framework and abstraction for writing cross platform and cross-browser plugins. Flash and Silverlight are themselves activex controls and npapi plugins, and I know of at least two media players written using FireBreath specifically. This is going to be the easiest way to approach the problem from a plugin perspective, but you will have to use C++. don't get me wrong -- this isn't an easy task even with FireBreath, but at least it solves a lot of the trickiest parts of being hosted in a browser.
The main advantage of a plugin is that you can do pretty much anything -- use hardware rendering, access the filesystem, etc. It is the most flexible option. The main disadvantage of a plugin is that you can do pretty much anything -- crash the browser, delete files, open up security holes if you aren't careful, etc.
I suppose the final option would be to use ajax requests, do the decoding in javascript, and render to a web canvas in Chrome, but I'm guessing that's still not very realistic =]
Good luck, hope that helps.
@Taxilian 的回答很好。
为了好玩,你可以走 HTML5 路线:
我愚蠢的 2 美分。
Great answer from @Taxilian.
For fun you could go the HTML5 route:
my silly 2 cents.
纯 HTML5/CSS3/javascript 和耐心让观众赶上现代浏览器。
不要自己实现视频解码,您只会创建另一个利基产品。
说真的,如果你今天提供的内容足以令人信服,人们就会在那里。专注于您的产品,而不是您的技术。
Pure HTML5/CSS3/javascript and patience for the audience to catch up on modern browsers.
Do not implement video decoding on your own, you'll just create another niche product.
Seriously, people'll be there if your offering is convincing enough by your content today. Focus on your offering, not on your technology.