media-player

Android: Simultaneous video playback and recording

*爱你&永不变心* 提交于 2019-12-06 03:29:17
问题 I'm developing a video chat like application for Android. Can I record and play video on the screen at the same time? Can I compose the videos over one another (FaceTime style) or do the y have to be side by side? Can I use the MediaPlayer and MediaRecorder classes or do I have to use lower level APIs? 回答1: Avner, To answer to your question bit wise 1> Can I record and play video on the screen at the same time? Ans : yes you can. 2> Can I compose the videos over one another (FaceTime style)

Android MediaPlayer error -1004 (ERROR_IO)

落爺英雄遲暮 提交于 2019-12-06 02:27:49
My application plays audio stream Here the code: MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource(url); mediaPlayer.prepare(); mediaPlayer.start(); url is local file (127.0.0.1) I use my own HttpServer which runs on the same phone. After call to mediaPlayer.prepare(); I get the error: error (1, -1004) which is ERROR_IO Any idea what is this error? Thanks, Costa. the problem is php5 which sends a 500 http header if your server does not send the correct headers Android MediaPlayer error -1004 (ERROR_IO) You can use

Failure code -32 MediaPlayer (Android 4.4)

假如想象 提交于 2019-12-06 01:12:33
Hello guys my app returns failure code -32 when trying to play a video in Android 4.4 (KitKat). I can't actually find any information about this errorcode perhaps any of you knows more about this issue? 11-04 13:43:08.966: E/AndroidRuntime(26482): java.lang.RuntimeException: failure code: -32 11-04 13:43:08.966: E/AndroidRuntime(26482): at android.media.MediaPlayer.invoke(MediaPlayer.java:664) 11-04 13:43:08.966: E/AndroidRuntime(26482): at android.media.MediaPlayer.getInbandTrackInfo(MediaPlayer.java:1692) 11-04 13:43:08.966: E/AndroidRuntime(26482): at android.media.MediaPlayer

MediaPlayer sometimes not preparing when screen is locked

China☆狼群 提交于 2019-12-06 00:52:47
I have a MusicService for MediaPlayback, wich uses a MediaPlayer with the settings: player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); player.setAudioStreamType(AudioManager.STREAM_MUSIC); and those Listeners are set: OnPreparedListener, OnCompletionListener, OnErrorListener, OnSeekCompleteListener The MediaPlayer is used for mp3-Playback. When one Song is finished, onCompletion is called. Then PlayNext is called, wich resets the MediaPlayer, then sets the Datasource with the URI of the next Track. Uri is loaded with: Uri trackUri = ContentUris .withAppendedId(android

MediaPlayer.getDuration() returning wrong duration

旧城冷巷雨未停 提交于 2019-12-06 00:05:59
The MediaPlayer's getDuration() method is giving me an incorrect value for some audio files. I think the common trait for all these files is that they were manipulated using Audacity or some other audio editing tool. This is a problem when trying to tie MediaPlayer progress to a Progress Bar. I went ahead and logged it: while(mPlayer.isPlaying()) Log.i("progress/total", mPlayer.getCurrentPosition() + "/" + mPlayer.getDuration()); and found this: I/progress/total(643): 14615/14620 I/progress/total(643): 14647/14620 This is only two log line of thousands, but the point is after the progress

MediaPlayer not playing audio properly

走远了吗. 提交于 2019-12-05 21:52:01
I'm trying to play an audio in background from a WebView. This audio is given by a URL. I approached this by overriding the url loading. And it starts playing the audio, but many times the Media Player just stops. This happens around 30% of times, and this audio files are never longer than 30 seconds. I tried with MP3, OGG and WAV, and it happens with any of them. I also tried but first downloading the file and then playing it, instead of stream it, but doesn't work either. This is a piece of code... to show you how it works: public boolean shouldOverrideUrlLoading(WebView view, String url) {

Android: MediaPlayer onPrepared is not being called

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 21:46:52
As title says, the onPrepared() overridden method is not being called. mediaPlayer = new MediaPlayer(); mediaPlayer.setOnPreparedListener(new OnPreparedListener(){ @Override public void onPrepared(MediaPlayer mp){ if (mp.equals(mediaPlayer)) isReady_mediaPlayer = true; Log.e("I", "Media player has been loaded to memory !"); } }); mediaPlayer = MediaPlayer.create(this, R.raw.my_sound_mp3); It's because you are creating a new MediaPlayer object. This one does not have any onPreparededListener set on it. Here you create and assign a MediaPlayer object: mediaPlayer = new MediaPlayer(); Next you

QtQuick: cannot playback any video on embedded linux

喜夏-厌秋 提交于 2019-12-05 21:28:03
I cross compiled Qt 5.2.1 for TI AM335x board using the toolchain provided by TI together with their SDK 6.00.00. Unluckily I am not able to reproduce any video in QML... The debug console tells: defaultServiceProvider::requestService(): no service found for – “org.qt-project.qt.mediaplayer” Is there something that I am missing in cross-compilation? maybe some dependencies? Can somebody help me in determining what I am missing? You can find here my cross-compilation configuration and here the full trace of messages produced by the application when setting the environment variable QT_DEBUG

Android: What video format/encoding should I use to support most of the android devices

时光总嘲笑我的痴心妄想 提交于 2019-12-05 20:59:24
I have a collection of video clips which user should be able play from inside my app (not external video player). I am using VideoView with MediaController. Everything works as expected on my Desire HD and Nexus S (both running Android 2.3.3). However they won't play on order devices. I get "Sorry, this video cannot be played" error message. All videos are mp4, encoded with H.264, 720w/480h, 25fps . I have also used H.263(3gp) but with no luck. I want to support as many Android devices as possible. At least starting from 2.1 Does any one had the same problems? What videos are you using in your

how to enable media sound even in silent mode

时间秒杀一切 提交于 2019-12-05 19:21:11
how do i start the sound even in silent mode? i got my audio file in my raw folder. i've made some codes but when i go to sound settings of android the ringtone and alarm are the only ones that are changed to maximum but not the media part. here is my code public void playSound(Context context) { AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); int maxVolumeAlarm = audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM); int maxVolumeRing = audioManager.getStreamMaxVolume(AudioManager.STREAM_RING); audioManager.setRingerMode(AudioManager.RINGER_MODE