Vlcj audio only player - java

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?

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.

Related

Where to store local video for playback in Android Studio

I am making a simple video playback application in Android Studio. The video is approximately 600MB, and has an appropriate title (no spaces etc.). The video will be played back using VideoView.
Where should the video be saved? When it is placed in src/res/raw, (like other files I am using such as .wav for sound effects), it creates resource errors. Do I create a new folder called assets and store the videos there?
Noooo. You will not put that video in your apk. Will your app exceed 600mb size on playstore. See on google documentation.
Google Play currently requires that your APK file be no more than 100MB
Solution:
First try to compress your video, as you don't need high resolution video.
Put video on cloud (like Amazon s3 bucket).
Download this video file at run time in device from Amazon. And then play it anywhere from device storage.

Read current audio output - Android

I want to know if it is possible to access the audio that is currently playing on the Android device.
Example: if Spotify is running in the background, I want to access the audio to control some LEDs that are connected to my RaspberryPi.
I want to create some sort of equalizer that changes colors depending on the sound that is currently playing. I appreciate if some one could tell me if accessing the main audio output is possible or not.
Unless you are using a rooted phone, it's not possible to capture output of a random app on Android.
You can however create an app that plays media files and captures the output for the purpose of visualization with "Visualizer" effect. You can take a look on the sample here: https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/src/com/example/android/apis/media/AudioFxDemo.java
(look for "Visualizer").
If you are using Raspberry Pi anyway, you can just play all your music through it, capture and analyze it there. You will need an external USB sound card though. See for example this post: http://www.g7smy.co.uk/2013/08/recording-sound-on-the-raspberry-pi/
There they just record and play audio back, but you can insert an analysis phase in between.

Kurento Video Streaming

I want to access the video stream being recorded by Kurento in Real-Time.
In the default implementation, I can only get hold of the video once the call is completed, but how can I access the file as it is being created?
You should be able to connect a PlayerEndpoint or a media player to watch the recording in real time, if the recorded file is in VP8 format. On the other hand, if you are recording in .mp4 format, there is no way to do that because .mp4 stores certain information when the recording process ends. This is not particular to Kurento, but to .mp4

How to read and play realtime sound stream in java?

I'm using Java to read and play some real time audio streams such as the voice from radio station.
I have the real time web address like this one and it can be played in a web browser.
How can I play it using Java language?
Thanks.
MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format support for Java Platform. It supports streaming, ID3v2 frames, Equalizer etc. It is based on JLayer and Tritonus Java libraries.
You can use this library MP3 SPI for Java Sound , and its documentation here.
Library reference

How to play other video formats in JavaFX

I am busy with a movie/video-clip player/library.
I want to do this in JavafX. Almost 90% of the video clips is in AVI format. I cannot for several reasons covert the movies/video-clips.
I also want the program to mark the video files that were played, from start to complete, so that I will know what have been watched. So the program needs to be able to interact with the video player to know when the video has played to the end.
JavafX doesn't allow playback for AVI files. What's the alternative to be able to use this with? And how will I know if the video has fully played from beginning to end.
I read the following
Adding other video codecs / DVD support to JavaFX 2.2
Where they suggest I use portable VLC player. Is this the best way to use it in JavafX and if possible does the API have register hooks to register a method that can be triggered to know when the video has stopped?

Categories