fast forwarding Audio file using media player android - android

how to fast forwarding an Audio file using media player in android on seekbar progress change?

I would use the 'seekTo()'-method and jump about 10 or 20 seconds each time.

I don't think MediaPlayer can do much more than play/pause actually. I'm using SoundPool non-stop, so someone should correct me if I'm wrong here.
I think you might need to add different versions of the song (with different speed) and change the actual source each time you want to speed up.

Related

ExoPlayer playing currently recording media files

Let me refraise my question, I wrote it in a hurry.
Current situation:
I have set up a digital video recorder to record broadcasts provided via DVB-C. It is running on a raspberry 3B using TVHeadend and jetty/cling to provide UPnP and other possibilities to access media files. For watching recordings, I wrote an android player app using IJKPlayer, which runs on smartphones, FireTV and AndroidTV.
One hassle when playing media files which are currently beeing recorded is, that IJKPlayer doesn not support timeshifting. Means, when I start playing a currently recording file, I can only watch the length which is known by the player at that moment. Anything which is recorded afterwards can not be played. I need to exit the player activity and start it again. I have resolved that issue by "simulating" a completed recoding using a custom servlet implementation. Since the complete length of the recording is already known, I can use ffmpeg to accomplish this.
Future situation:
I plan to move away from IJKPlayer to ExoPlayer, because it supports hardware playback and is much faster when playing h.264 media. I can of course use the same solution like above, but as far as I have found out yet, ExoPlayer can support media files which are currently being recorded by using the Timeline class. However, I don't seem to find neither a usefull documentation nor any good example. Hence, I would appreciate any help with the timeline object.
Regards
Harry
Looks like my approach won't work. At least, I didn't find a solution. Problem is, that the server returns the stream size as it is during player-start-time. I didn't find a method to update the media duration for "regular" files.
However, I can solve the problem by changing the server side. Instead of accessing a regular file, I convert the file to m3u8 in realtime, using ffmpeg. I then throw the m3u8 URI onto the player and it updates the duration of the stream (while playing) without the need to create any additional code on the client side.

Android ExoPlayer : Does it solve gapless / seamless playback issue that is broken for the Android Media Player

Has anyone tried using ExoPlayer to achieve this?
I tried looking online with no success.
When I say gapless playback, I am referring to the problem of using the media player to play local videos back to back. After the first video is done playing, there is a noticeable delay of 1 second before the second video starts.
Hoping this question helps in understanding this issue further.
For reference please look at the following question:
Android: MediaPlayer gapless or seamless Video Playing
ExoPlayer 2, which is now officially released, seems to support gapless playback using the ConcatenatingMediaSource class. From its developer guide:
Transitions between sources are seamless. There is no requirement that the sources being concatenated are of the same format (e.g. it’s fine to concatenate a video file containing 480p H264 with one that contains 720p VP9). The sources may even be of different types (e.g. it’s fine to concatenate a video with an audio only stream).
And the example code:
MediaSource firstSource = new ExtractorMediaSource(firstVideoUri, ...);
MediaSource secondSource = new ExtractorMediaSource(secondVideoUri, ...);
// Plays the first video, then the second video.
ConcatenatingMediaSource concatenatedSource =
new ConcatenatingMediaSource(firstSource, secondSource);
EDIT: ExoPlayer 2 supports gapless playback, but as of the time of writing is still unreleased as a stable version.
You will most likely never be able to achieve perfect gapless playback of multiple tracks with ExoPlayer or Android Media Player. Neither have been written to support starting multiple tracks and I imagine it will stay out of scope for both of them.
You can achieve gapless playback by using 2 different player instances, once you have started and played the first, you can load the second and start playback once the first finishes. Using this method you could have a gapless solution, as long as you prepare the second video during playback of the first.
To take it further, you can also use 2 different surface textures for rendering the multiple videos, once the first video reaches the end you could fade out the texture and fade in the new one. Resulting in a nice seamless video effect.
Because of the nature of playing multiple videos at once you will most likely want to create your own timer for incrementing the time and deciding when to switch to the next video, rather than trying to use the callbacks from ExoPlayer or Android Media. This will allow you to keep track of the time in a more accurate fashion, without needing to keep talking to multiple video codecs.
I know this is not the answer you've been looking for, but it's the only reasonable answer. The sole way to ensure no gaps in playback is to download the entire file first and begin playback when it's done. Otherwise, in the event that you lose connectivity before the file is finished downloading, pausing is inescapable.
I just tried switching to ExoPlayer from the standard MediaPlayer implementation and the gap is the same if not worse. However I have used a very simple method of restarting the player when the status changes to ended. I don't know if there's a better proper way to do it, perhaps with 2 different ExoPlayers.

mp3 tune as background tune for android animation

I am newbie to android, and want to set mp3 tune as a background tune for an animation. I have an animation(clock) running as a frame animation and I want to set an mp3 file for that.
the mp3 should play sequentially with the seconds hand in my clock animation,any Idea?
Thanks in advance....!
Android audio tutorial
Take a look to Audio and Video processing on Developer.android.com

Using Eclipse, Sound is not playing fully on emulator? Sound bytes too long?

I am currently trying to make a Soundboard application for my Android.
Using Eclipse, I have successfully made buttons and coded them so that when pressed, they play .ogg sounds in the res/raw folder. All is okay.
Now, I have discovered that any files over about 6 seconds long aren't playing fully.
Is there any way to correct this problem? I would normally just trim the files, but some of them need to be a bit longer, but none are over 50 seconds.
Thanks alot!
What is happening is the mediaPlayer.start() instruction is being called before the file has finished fully loading. Assuming you are using mediaPlayer.create(this, resid) followed by .start() there are a few things that can help. The "right" way to do it is to put the .start() instruction inside of an onPreparedListener since .create calls .onPrepared the first time, but honestly when I put that in my soundboards I got tons of crash reports, so I reverted to just using .start after .create.
I found the problem usually occurs if the sound file is very high bitrate, or if the app is installed on a slow sdcard. I use mp3's, but usually cap the bitrate at 96k and put in the app description that if the clips aren't playing fully to move the app back to internal memory and the complaints seem to have stopped.

Android: Switching noise in SoundBoard

I am developing a Soundboard application. I use MediaPlayer to Play Ogg sound files. Now when I switch from one sound to another sound, I get a noise similar to the ones heard while switching radio stations. I do not want this noise. How to eliminate it? Any Ideas? Thank You
Probably a silly answer but try adjusting the volume level to the lowest possible before making the switch, then resetting back to the user's original level when completed - sorry.
I found out. It was because of the conversion of the files from mp3 to ogg. MP3 files were of higher bitrate and when converted to ogg ended up in the loss of quality which resulted in the noise.

Categories

Resources