android-mediaplayer

Android SurfaceView: Show Video after Images

妖精的绣舞 提交于 2019-12-13 16:01:42
问题 I want to play a video after a couple of images in the same SurfaceView. If I show images AFTER videos, everything works fine. But if I want to play a video after the images, the SurfaceView stays blank (black). Can anyone help? It seems to be a problem of clearing or resetting the SurfaceView! The code of the SurfaceView (custom SurfaceView!!!): public class MySurfaceView extends SurfaceView implements SurfaceHolder.Callback, MediaPlayer.OnCompletionListener { private Bitmap image; private

Android Visualizer error only in Android 6.0

孤街醉人 提交于 2019-12-13 12:38:34
问题 i've found one issue related with Visualizer that takes place only in Android 6.0 devices. Don't really know why it happens, so any kind of help would be appreciated. Here is the error stack: AudioEffect: set(): AudioFlinger could not create effect, status: -1 visualizers-JNI: Visualizer initCheck failed -3 Visualizer-JAVA: Error code -3 when initializing Visualizer. java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3 System.err: at android.media.audiofx.Visualizer.

Is it possible to play music during calls so that the partner can hear it ? Android

白昼怎懂夜的黑 提交于 2019-12-13 11:34:23
问题 I'm trying to make and app like Call Cheater(Originally developed for Symbian OS) Is it possible to play a music during a phone conversation where receiver and caller should hear the same sound or music? If yes how can I implement this? 回答1: You failed to find an app that does this because it is not possible . The documentation clearly states (here): Note : You can play back the audio data only to the standard output device. Currently, that is the mobile device speaker or a Bluetooth headset.

Android MediaPlayer continues playing after screen is turned off

帅比萌擦擦* 提交于 2019-12-13 10:45:26
问题 I'm trying to follow the Core App Quality guideline FN-A1 that says that audio shouldn't play when the screen is off, so I checked it, and it does continue playing after I turn the screen off, but I'm not sure why. I don't think I'm using a service, and it seems that MediaPlayer should stop playing by default. Can anyone help me figure what I did wrong? I've copied the relevant parts of code. Thanks public class RecordActivity extends BaseActivity { MediaPlayer playback; @Override protected

how to play sound in specific times?

限于喜欢 提交于 2019-12-13 09:22:32
问题 hi i had android app which play sound when value on i did my code well and it worked well . I need to make as list or array or whatever have specific days with times as : day 07.07.1013 times 3.30pm , 1.20am ,3.30am ....etc. as when the day 07.07.2013 and the o'clock 1.20am the sound play . how to do that ? @JavascriptInterface public void playsound(String value ) { if (value.equals("on")){ checked = true; mp.setLooping(true); mp.start(); } else { checked = false; mp.stop(); } } 回答1: Use

wait until current media finish playing before it play another in android

二次信任 提交于 2019-12-13 09:04:06
问题 Here is my media player code in android. My problem is the loop plays all the files from the zipfolder without waiting for the current to finish playing. How do I solve this problem. I am quite new to android doing my first project ! Need some expert help. //code import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.apache.commons.io

How can I use button to play a sound with ListView?

烂漫一生 提交于 2019-12-13 08:45:48
问题 I want to add a button in ListView to play sound. The problem is the IDE (in List.java) cannot resolve this method mediaPlayer.create(this,R.raw.people); The MainActivity.java code public class MainActivity extends AppCompatActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArrayList<String> list = new ArrayList<String>(); list.add("item1"); //instantiate custom adapter List adapter = new List(list

Android MediaPlayer : How do i show a progress dialog while buffering audio

风流意气都作罢 提交于 2019-12-13 08:25:40
问题 Im trying to play an mp3 audio from url. But when having slow network, player seems like not responding while buffering. So i need to add a progress dialog while buffering . Is it possible.? if yes can anyone help me to do.? public class Player extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); Bundle b = new Bundle(); b = getIntent().getExtras(); final String url = b

How do I add song title and album art in a listview and launch a player on click?

冷暖自知 提交于 2019-12-13 07:56:10
问题 I am making a music player app that contains several tabs (Songs, Playlist, Albums etc). Each represents by a fragment. As of now I have failed to create a even song list using media store. Here's a code I have tried but it is not working public class Songs extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor> { SongsAdapter mAdapter; private static final String ARG_POSITION = "position"; private int position; public static Songs newInstance(int position) { Songs f = new Songs

Mediaplayer error once used multiple times

隐身守侯 提交于 2019-12-13 07:23:39
问题 I've created a game which is nearly complete, but I've still got one problem: Once I press a button I want a sound to play, I did this with this code: MediaPlayer planeSound = MediaPlayer.create(ObjectCanvas.getDrawContext(), R.raw.plane); planeSound.start(); It works perfectly, but the only problem is when I press it a lot of times, then the MediaPlayer gives a error which is error (-19,0). I searched but I can't find a solution for this. If the error happens the MediaPlayer won't play any