New to Android Studio and android programming, I have looked here and the rest of the web but not been able to find a solution.
I am using viewflipper to create a slide show with next and previous buttons, this works just as it should. With each new image the user can touch the screen and get a short audio playback about image. There are 32 images for the first 15 all works well but after that the audio playback part stops working.
Is there a way to set mediaplayer to play all 32 if required or does the media player have to be reset after each playback.
I am using an onclick method to play the sound, I do not want to place more buttons on the screen to reset the player, also if the user touches the screen after the initial playing of the audio then the audio will play again.
Is what I am trying to do possible
Related
I made an app that uses the onkeyevent functions to capture the bluetooth camera shutter buttons with up and down volumes. I am trying to use it for a camera app to take pictures when the screen is off.
However this no longer works if the screen is locked or off. The minute the screen is back on the function works again. So I know the bluetooth is still connected.
Can anyone with experience in this tell me if it's possible for the phone to capture bluetooth events when the screen is off. What changes should I make.
I am developing an App, which can play a tone at a fixed frequency to the users by using the Audiotrack Java class. Now the sound can be played when a button is pressed, I want to keep the sound keep playing when the screen is off, because the users may want to listen to the sound for 20 minutes at night where doesn't require the screen on all the time. Anyone can help with this?
I have tried the WakeLock according to other posts on Stack overflow, but it doesn't work. when I go to the activity, the app stops and quits.
To keep sound playing when the screen is off, use a foreground service to play the sound and when the user clicks the start button, you should start your service
I use cordova to develop a app to show video clips and using this https://github.com/dawsonloudon/VideoPlayer plugin to show video in my application.
My requirement is, measure how long has user seen every clip so that I can change java code of plugin.
Here is the code of plug-in which play the video:
intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "video/*");
this.cordova.getActivity().startActivity(intent);
I can find the time of when video has started playing. What I don't know is how to find the time of when video has stopped playing or when user tapped back button.
Another problem is I don't know how to send this start and end time of video to the html page to display to the user.
To detect when back key pressed you can use onBackPressed().
To detect when video has you can use onPause().
To detect when intent finished finish()
For full documentation visit here
I have a VideoView without any audio playing every time I start my app. I have noticed that when it starts playing, music playing from other apps in the background pauses. Is there any solution to this? Thank you!
Playing video while background music playing is not recommended:
To ensure a great user experience, it’s also important that your app manages the audio focus to ensure multiple apps aren’t playing audio at the same time.
You can check this for more information.
When you start play video using VideoView, you app request the audio focus, this mean the background app which is playing music lose the audio focus. The background app's behavior depends on the code in AudioManager.OnAudioFocusChangeListener.OnAudioFocusChangeListener method. You can not change it.
More information, see Managing Audio Focus.
I'm building an app for Android using the YouTube API. The video is in a scroll widget, and when I scroll and the video goes up or down the screen, it stops. I want the video to continue even though isn't in the screen. How can I do that?
i went through the same problem, i open this question:
Android YouTube API video pause when rotate screen or hide player
see the comments to understand better. For the tests I did, the Youtube API knows when the player is not showing on the screen and just pause the video. As a workaround I changed my layout so that the player be fixed on the screen, just as is the official app from youtube.
I use this question as reference:
Scrolling Text Above Buttons, Buttons Fixed At Bottom