media-player

Calling another activity when mediaplayer get finished playing

十年热恋 提交于 2019-12-18 04:27:14
问题 Hi I used the following code to call an activity when audio play get finished. But I want to play the audio in current activity, when play get finished it has to jump for the next activity. But here it jumps to the next activity and play the audio. Any suggestions. package com.fsp.mus; import java.io.File; import java.io.IOException; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content

MediaMetadataRetriever on streaming source

浪尽此生 提交于 2019-12-18 04:02:59
问题 I am having a tough time displaying the current track playing from a streaming source. Using MediaMetaDataRetriever class returns a NULL, meaning it failed. I wrote a simple method but now I'm inclining to think this only works on media files like MP3, WMA, AVI, etc. public void metaData(){ mmr.setDataSource(urlStation); String metaD = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST); Toast.makeText(MainActivity.this, "Artist = " + metaD, Toast.LENGTH_LONG).show(); Any

Android MediaPlayer - how to play in the STREAM_ALARM?

旧城冷巷雨未停 提交于 2019-12-18 04:01:54
问题 I've tried settings the audio stream of the media player in my application using the following code but when I do this I hear no sound in the emulator. If I don't set the stream for the player then the audio plays fine. I'm sure I'm using this wrong but cannot workout how, any help? MediaPlayer player = MediaPlayer.create(getApplicationContext(), R.raw.test_audio); AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE); audioManager

How to set WPF window position in secondary display

故事扮演 提交于 2019-12-18 03:06:08
问题 I have two displays. I want to make a media player and I want to play video full screen on my secondary display. So I’m trying to make a media player using WPF Here is the code so far I wrote Screen[] _screens = Screen.AllScreens; System.Drawing.Rectangle ractagle = _screens[1].Bounds; //player is my window player.WindowState = WindowState.Maximized; player.WindowStyle = WindowStyle.None; player.Left = ractagle.X; player.Top = ractagle.Y; // MediaControl is an media elements MediaControl

Android media player and seekbar sync issue

江枫思渺然 提交于 2019-12-18 02:59:13
问题 I am working on a media player app. I am trying to sync it to a seekbar so that when media is played the seek bar progresses automatically. Here is my source code: public class MusicDroid extends ListActivity implements SeekBar.OnSeekBarChangeListener, Runnable { private int cur_time = 0; private SeekBar seekbar; int song_dur = 0; GroveService gs; public Chronometer timer; int timer_time = 0; @Override public void onCreate(Bundle icicle) { try { super.onCreate(icicle); setContentView(R.layout

How to attach MediaPlayer with SurfaceView in android?

只愿长相守 提交于 2019-12-17 22:24:48
问题 I'm building video player with android media player object. i'm able to hear the audio but the video does not appear on surfaceView. here is my code public class PlayerActivity extends Activity implements SurfaceHolder.Callback { String path; private MediaPlayer mp; private SurfaceView mPreview; private SurfaceHolder holder; boolean pausing = false; public static String filepath; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

Android: MediaPlayer gapless or seamless Video Playing

时光总嘲笑我的痴心妄想 提交于 2019-12-17 22:07:42
问题 I can play the videos fine back to back by implementing the OnCompletionListener to set the data source to a different file. No problems there. I call reset() and prepare() just fine. What I haven't been able to figure out, is how to get rid of the 1-2 second gap screen flicker between the data source change and the new video starting. The gap shows a black screen, and I haven't found any way to get around it. I've tried setting the background of the parent view to an image, but it manages to

Record audio on Android with MediaPlayer as source?

这一生的挚爱 提交于 2019-12-17 19:39:03
问题 On Android, you can record audio from the microphone using the MediaRecorder class: MediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); I want to record some parts of audio being played by a MediaPlayer instance instead (or some other audio playback device). Is that possible? How would I set a custom audio source? To summarize; how do I stream audio into the MediaRecorder from an arbitrary audio source? 回答1: I don't think there is an API for that for now. Though it IS possible, you

MediaPlayer.seekTo() does not work for unbuffered position

元气小坏坏 提交于 2019-12-17 19:34:31
问题 I use MediaPlayer for playing a single mp3 song from network. Data source is a HTTP URL. Let's assume we have following playing state. Song duration: 1:00 Current progress: 0:10 Current buffering progress 0:30 Let's say I want to skip some part of a song and seek forward. I do it with MediaPlayer.seekTo() method. If I seek to buffered position (0:20) it is performed correctly. But if I seek to a position which has not been buffered yet (0:40) the MediaPlayer behaves odd. It indicates

Stream live video from phone to phone using socket fd

穿精又带淫゛_ 提交于 2019-12-17 15:23:08
问题 I am new to android programming and have found myself stuck I have been researching various ways to stream live video from phone to phone and seem to have it mostly functional, except of course the most important part: playing the stream. It appears to be sending the stream from one phone, but the second phone is not able to play the stream. Here is the code for the playing side public class VideoPlayback extends Activity implements Callback { MediaPlayer mp; private SurfaceView mPreview;