Sure, here’s the translation: Vlcj音频播放器

huangapple go评论69阅读模式
英文:

Vlcj audio only player

问题

我正在创建一个聊天应用,用户可以发送音频和视频文件。

对于我的视频文件,我已经成功在应用程序中创建了一个嵌入式视频播放器,可以播放任何视频。

但是对于我的音频文件,我不想使用带有vout=dummy选项的嵌入式视频播放器,相反我想要进行优化,并且使用DirectAudioPlayer来实现我的目的。我查看了MediaFactory的create方法,但是我不明白我应该如何为特定文件检索这些参数。

我想要的是在我的应用程序中只有一个直接的音频播放器,我可以将其用于多个音频文件,这种做法可行吗?

英文:

I am creating a chat application where the user can send audio and video files.

For my video files I have successfully created an embedded video player in my app which will play any video.

But for my audio files I don't want to use an embedded video player with options vout=dummy instead I want to be optimized and use an DirectAudioPlayer for my purposes. I took a look at the MediaFactory create but i don't understand how am I suppose to retrieve these parameters for an specific file.

What I want is just one direct audio player in my application which I can reuse for multiple audio files or is this not possible?

答案1

得分: 1

你可以使用HeadlessMediaPlayer

这基本上与你已经在使用的EmbeddedMediaPlayer相同,但没有与显示视频有关的API。

但是需要注意,如果你通过HeadlessMediaPlayer播放视频,而不仅仅是音频文件,LibVLC将会打开一个本地窗口并播放视频 - 你可以通过通过MediaPlayerFactory传递"--no-video"来抑制这个行为。

当你想要在应用程序中访问音频缓冲区时,会使用DirectAudioPlayer - 也就是对本地音频缓冲区的“直接”访问。然后,你将不得不使用JavaSound或类似的东西来实际播放音频。所以我认为这不是你想要的。

英文:

You can use a HeadlessMediaPlayer.

This is basically the same as the EmbeddedMediaPlayer that you're already using, but with no API to do with displaying the video.

A word of caution though if you play a video through the HeadlessMediaPlayer, rather than just an audio file, LibVLC will open a native window and play the video - you can suppress this by passing "--no-video" via the MediaPlayerFactory.

The DirectAudioPlayer is used when you want to access the audio buffer in your application - i.e. "direct" access to the native audio buffer. You would then have to use JavaSound or something to actually play the audio. So I don't think this is what you want.

huangapple
  • 本文由 发表于 2020年7月28日 22:09:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/63136071.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定