android-mediaplayer

How to increase volume of mediaPlayer

☆樱花仙子☆ 提交于 2019-12-07 16:42:35
问题 I am writing an app that in some situations warns user with an alarm sound. My problem is that in some situation volume of media playing may be decreased by user or even media volume is silent. I want to check the volume programatically and increase it to 100% and then play alarm. Any idea? Note that I have tested mediaPlayer.setVolume(1,1) and nothing changed. 回答1: This isn't the function for setting the volume. Here it's the setting of the volume to any value: AudioManager audioManager =

Stop Android MediaPlayer automatically launched by webpage within WebView

笑着哭i 提交于 2019-12-07 12:53:40
问题 one of the activities of my Android app contains a WebView that displays the GrooveShark player webpage. When the user taps on the play button of the webpage the activity automatically launches a default MediaPlayer that plays the track. Everything works fine, the problem arises when the user closes this activity and the MediaPlayer, although is not playing the track anymore, it remains alive ... even when the app is closed, the MediaPlayer is still alive. The only way to kill it is by

How to adjust play speed of video on android? [closed]

╄→гoц情女王★ 提交于 2019-12-07 11:14:35
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I need to implement a requriment of adjust play speed when playing a video, how can I do that using Android API (MediaPlayer) or other 3rd-party library? I google it, and no any idea by far. Any suggestions welcome, thank you. 回答1: Media player does not provide what you want. You

Does Android support slow-motion video playback?

梦想与她 提交于 2019-12-07 09:30:00
问题 I need to make video player on Android that is able to play in slow motion and with different playback speeds. I still cannot find a native API or some code to do this. Does Android 2.2 - 2.3 support to video slow-motion and can we control the video playback speed? 回答1: Yes, from API 23 android has PlaybackParams class .It supports adjustment of playback speed of video briefly given here . 回答2: You can try exploring libVLC for this. VLC player for Android is almost due. Check their website.

Android Media Player using service

爷,独闯天下 提交于 2019-12-07 07:15:01
问题 I created a MediaPlayer class to play mp3 files. Everything was fine, then my player stopped playing while it was in background and I found out that my problem was I did not create it in a service, so I started to read about services to learn how to create one and use it for my player. My question is, what is the best way for me to communicate between the service and my application? Should I use the message or send intents or bind it? I should also create a UI in notification area, also to

Android MediaPlayer java.io.IOException: Prepare failed.: status=0x1

╄→尐↘猪︶ㄣ 提交于 2019-12-07 07:03:29
问题 I am using Android's MediaPlayer to set up a URL stream in my application. I have tried several different posts to deal with the exit code and error: (1, -2147483648). I have attempted several different streams, but I can't seem to get the MediaPlayer to work. I have thought about moving over the Google's ExoPlayer but it is a little more complex and I don't want to jump ship in case I am missing something. MediaPlayer: private MediaPlayer player; String url = "http://199.180.75.118:80/stream

Music Player asking for Write External Storage Permission?

人盡茶涼 提交于 2019-12-07 06:12:12
问题 I'm creating a music player application in Android. It works fine but whenever I scroll in songs list it starts crashing and gives this exception Process: com.example.lenovo.musicplayer, PID: 31100 java.lang.SecurityException: External path: /storage/emulated/0/Android/data/com.android.providers.media/albumthumbs/1460104607336: Neither user 10294 nor current process has android.permission.WRITE_EXTERNAL_STORAGE. at android.os.Parcel.readException(Parcel.java:1555) at android.database

How to make lock screen notification for media player

孤街浪徒 提交于 2019-12-07 05:09:39
问题 I am trying to get lock screen in the mobile I am able to get every thing work like notification and other things of my app but when I try to display the lock screen it is not working at all for android M. private void initMediaSession() throws RemoteException { if (mediaSessionManager != null) return; //mediaSessionManager exists ComponentName mediaButtonReceiver = new ComponentName(getApplicationContext(), MediaButtonReceiver.class); mediaSession = new MediaSessionCompat

How do I use the default click sound using view.playSoundEffect(SoundEffectConstants.CLICK);

岁酱吖の 提交于 2019-12-07 05:06:23
问题 I wan to use the default TICK sound but I dont know how or where to put this code view.playSoundEffect(SoundEffectConstants.CLICK); I found this code in another post. This is the code I have: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final MediaPlayer mp = MediaPlayer.create(this, R.raw.blah); Button Button01 = (Button)this.findViewById(R.id.Button01); Button01.setOnClickListener(new View.OnClickListener()

Android MediaPlayer won't play music on API 26+

丶灬走出姿态 提交于 2019-12-07 04:51:26
问题 I have an app that streams music for the user, this code works fine ok on devices running Android up to API 25, when i test in a device running API 26 or greater the Music wont play and wont show an error message either, attached is my log when using API 28 device. What i have tried: MediaPlayer.setAudioStreamType(int streamtype) Deprecated so i implemented AudioAttributes for API above 26 Different types of mp3 files, but they all play the same in api 25 and below, when i try on device or