我们可以使用Applet播放音频和视频文件吗?
我需要开发同时播放音频和视频文件的网页。我们需要使用向上、向下、向左和向右按钮等箭头来更改控件来管理音频或视频。
问候, 宁静。
I need to develop the webpage which plays both audio and video files. And we need to change the controls using arrows like Up, Down, Left and Right buttons to manage the audio or video.
Regards,
Serenity.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这些音频和视频文件的格式是你严格控制的,那么有一些方法可以在Java中实现这一点。否则,Java 并不是加载和使用各种媒体类型的良好语言选择。
例如, javax.sound.sampled包涵盖 AU、WAV 和 AU 等内容。 SND。它使用服务提供商接口来支持您可以为其提供解码器/编码器的其他格式。可以使用 Java 媒体框架 (JMF)。
提到 JMF,我们就想到了视频。 JMF 可以加载和播放某些类型的 MOV、AVI 和 MPEG 文件,但不是所有类型。EG 我有 2 台可以录制 MOV 的柯达相机,较旧的相机生成与 JMF 兼容的 MOV 文件,较新的 MOV 则不然。 JMF 是“废弃软件”,在当时是一个非常好的 API - 它实际上只是在今天落后,因为缺乏对更现代的 CODEC(编码/文件类型)和网络摄像头分辨率的支持。
话虽如此,您的经验不足表明您没有指定是支持“受控”还是“每种”格式,这表明您需要很长的学习曲线才能完成这项任务。 :-(
If these audio and video files are of formats strictly controlled by you, then there are ways to achieve this in Java. Otherwise Java is not a good choice of language for loading and using a wide variety of media types.
For example, the javax.sound.sampled package covers things like AU, WAV & SND. It uses the Service Provider Interface for supporting other formats for which you can provide a decoder/encoder. E.G. support for MP3s (decoding only) can be added using the mp3plugin.jar of the Java Media Framework (JMF).
And having mentioned JMF that brings us to video. JMF can load and play certain types of MOV, AVI and MPEG files, but not all types. E.G. I have 2 Kodak cameras that can record MOVs, the older one produces MOV files that are compatible with JMF, the newer MOVs aren't. JMF is 'abandon-ware' that was quite a good API in it's day - it really only lags today because of lack of support for the more modern CODECs (encoding/file types) - and web-cam resolutions.
Having said all that, your inexperience indicated in not specifying whether it is to support 'controlled' or 'every' format suggests you have a long learning curve to achieving this task. :-(