android embed default audio player in app/activity - android

I would like to know if it is possible to embed the default audio player into one of my activities. Or at least be able to embed the section that has the play/pause button and the audio track seek bar.
The reason I would like to embed it rather than open it in a new intent (like this:
Intent audioActivity = new Intent(Intent.ACTION_VIEW);
audioActivity.setDataAndType(Uri.parse(getAudioURL()), "audio/*");
startActivity(audioActivity);
)
is that I want the users to be able to read some content within the current activity while listening to the audio. I have been able to use a progress bar which updates based on the progress in the audio track, but this does not look good and i would rather have the look and feel of the default audio player. I know the default video/audio players are not documented very well but if this is at all possible I would like to know. Thanks!

Hi, I would like to know if it is possible to embed the default audio player into one of my activities.
No, sorry.
First, there is no such thing as "the default audio player" as a single entity. Each device has its own "default audio player".
Second, even if there were a single universal "default audio player", there is no way in Android to embed some other application's UI into your own.
Or at least be able to embed the section that has the play/pause button and the audio track seek bar.
No, sorry. See above.

I think what you're looking for is MediaController. This answer has a good example of how to use this, though I'm not sure if it is possible to have the controls displaying all the time (they disappear after 3 seconds in the example):
How can I show a MediaController while playing audio in Android?
There's another discussion of it here:
How to implement an audio player for Android using MediaPlayer And MediaController?

Related

Android: AudioManager for audio, is there a equivalent for Video

For android, I've researched for controlling Audio using AudioManager. Will there be one for video which I can control the video player to play/stop/pause.
The purpose of AudioManager isn't really to control audio playback, but to control such properties as volume, audio mode, and so on. If there is a media player in the background, that doesn't really mean that you control it, you can only send certain requests to the AudioManager which cause the system either to take some actions regarding the audio, or to send some events, which the audio player may respond to. So you don't have direct control over the other application.
Likewise, there is no system service which will make the video pause. The best equivalent of AudioManager you have which controls what is shown on the screen is WindowManager, but I think it's obvious that it can't be used to make a video player pause.
Your best bet for controlling an external video player would be to look up its intents, it may have some ways to control the playback from outside. This, of course, will be application specific.
There is no such API like VideoManager
You can handle videos through Primary API MediaPlayer and also see this useful article of multiple ways to handle videos

Is it possible to play/pause the current chromecast media stream by a generic Android app?

I can't find a way to do this. is it possible to control the media stream that is current playing on chromecast, like youtube, video app, music app, or whatever from a generic Android application?
I've tried many ways to do it, but I had no success. I'm able to join the chromecast while it's playing a video from youtube for example and get it's session id and some other info, but I can't play/pause the streaming. Is it possible to do it?
Thanks in advance.
It very much depends on the application that is running on the receiver; not all applications use the Media namespace (from the Cast SDK) for control; if they don't, you will not be able to do anything of the sort that you are trying to do. If they do, then you should be able to send control commands.

Play video with direct link on Android

I need to play a video with fullscreen when a user plays it.
Unfortunately, as far as I understand, if the HTML5 Video tag is used, Android plays it in-frame. So that tried webkitEnterFullScreen() and it seems to work(kind of...) but user has to click the play button again. Overall performance feels a bit clumsy and not sure if old OS like 2.0+ could handle it.
As an alternative method, I'm now trying to play video using direct link rather than the Video tag. For example, [a href="video.mp4"]Click to play[/a]. I think that it works well but the only problem is that it asks to choose a application either 'Video Player' or 'Browser'.
So my question is
How can I define using javascript to play the video using Video Player, so that the selection dialog won't prompt?.
What is the native video player for Android? For example, iOS uses Quicktime and it is possible to embed video using Quicktime object. And are there any equivalent method for Android?
When the Video tag is used, how to play video simultaneously with fullscreen?
try following code :
String path1="/path/to/video/file.3gp";
Uri uri=Uri.parse(path1);
VideoView video=(VideoView)findViewById(R.id.VideoView01);
video.setVideoURI(uri);
video.start();
You have to realize something very important: There is no native video player for android.
There is a dozens players for android and it is not your decision but the users decision if he should use player A or B. Don't try to force Android users to iOS behavior, it really doesn't give a better impression.

Modulate a recorded sound into different effects in android?

I'm going to make an app related to sound modulation , where i need to record a sound and after recording the sound i need to play it in different modulation or sound effects like Reversing,Resampling,Pitchshifting,Robatization effect when I press the play button .Now I have the code to record a sound ,but don't know how to modulate the recorder sound as the above effects.
I search the whole web but did not find any solution.how do i implement this effects?
There are many apis which helps to accomplish this. For example-
Open SLES. AudioTrack.
Please have a look at this page.
I think it may help you.

are we able to edit default media player of Honeycomb?

I'd like to add some functionality inside of default media player for honeycomb without making any other class that using mediaPlayer package from Android, such as showing the information for particular video by swiping the screen, etc. Is that possible? if not, there's no other way to make my own class for the media player :(
No, that is not possible: the default media player on Android can not be modified by third party code. If you want to build your own media player you can start by looking at this and in the platform samples, but you will need to do significantly more work to get a fully functional media player.

Categories

Resources