media-player

MediaPlayer Video not played

不问归期 提交于 2019-12-13 05:45:16
问题 I am trying to play a video from assets folder using media player. I am copying it on SD card first. The detailed code is as below. Activity public class ActivityMediaPlayer extends Activity implements Callback, OnBufferingUpdateListener, OnCompletionListener, OnPreparedListener{ private SurfaceView mPreview; private SurfaceHolder holder; private MediaPlayer mMediaPlayer; private int mVideoWidth; private int mVideoHeight; private static final String TAG = "MediaPlayerDemo"; File fvvVideoFile;

android-ndk crash in android::MediaCodec?

旧巷老猫 提交于 2019-12-13 05:23:39
问题 Can someone help me figure out what is the following crash about? Thanks. I/DEBUG ( 3007): Build fingerprint: 'samsung/zerofltetmo/zerofltetmo:5.1.1/LMY47X/G920TUVU2COF8:user/release-keys' I/DEBUG ( 3007): Revision: '11' I/DEBUG ( 3007): ABI: 'arm' I/DEBUG ( 3007): pid: 19656, tid: 21303, name: MediaCodec_loop >>> com.******.**** <<< I/DEBUG ( 3007): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x14 I/DEBUG ( 3007): r0 f4a23e40 r1 00000003 r2 ca10ab30 r3 00000000 I/DEBUG ( 3007): r4

MediaPlayer play songs serially

99封情书 提交于 2019-12-13 05:09:16
问题 I need to play let's say 10 songs (1-10) serially. After one is played and finished, the next one starts, etc. What I have in mind is: For (int i=0; i<10; i++) { mp = new MediaPlayer(); mp.setDataSource(/* something given i */); mp.prepare(); mp.start(); } But won't that cause just one song to be played only? What could I do to make a row of them? Thanks a lot 回答1: you can use mp.setOnCompletionListener for reading when a song is finished. See example below: mp.setOnCompletionListener(new

Set begin time of Azure Media Player

ぃ、小莉子 提交于 2019-12-13 05:00:03
问题 I want to start a AMP(Azure Media Player) HTML5 video on specific time to show specific content of the video. What does not work is the time to start. The videos always start at 0:00 and then plays nicely to the end. No useful notifications in js console. I read through some examples and the documentation and this is what I have tried, (note the line myPlayer.currentTime(30);): Script: var myPlayer = amp('vid1', { /* Options */ "nativeControlsForTouch": false, autoplay: false, controls: true,

Unable to play two MediaPlayer at same time in Nexus 5

有些话、适合烂在心里 提交于 2019-12-13 04:45:55
问题 I am trying to play some audio in background using two MediaPlayers inside a Service. Everything works fine if I want to play only one mp3, but If I try to play two at the same time, using two instances of MediaPlayer , only the last one works. It is weird because it works in emulator and some devices, but I am unable to make it work in a Nexus 5. This is the code I am using to create the two MediaPlayer instances: private void playWithPiano() { mp1 = initializePlayer(filenameVoz); //

iOS: lowering bitrate of MPMediaItem containing an iPod music

北城以北 提交于 2019-12-13 04:34:15
问题 I'm making an app which add a theme music to an video. Some user complains that if their music is in apple lossless format, the video will be too large. I found that is because the AVMutableComposition I use just put the original music format in to the video I generated. So is there any way I can lower the bitrate of the music in MPMediaItem, or change the format it is encoded? This is a code snippet of the code I use to add music to video. AVMutableComposition* mixComposition =

pausing a video after every 10s in c#

家住魔仙堡 提交于 2019-12-13 04:28:31
问题 what i want to do is pause a video after every 10s the video should pause after ever 10s till the video ends the code given below gives unexpected results the video pauses fine for the firs time (i.e after 10s) but when i play again it should pause after 10s but in my case it pauses randomly sometimes at 8s,3s 5s and etc what should i do?? please help thanks!! void PlayClick(object sender, EventArgs e) { VideoControl.Play(); var dispatcherTimer = new System.Windows.Threading.DispatcherTimer()

Playing and Pausing Media Player on same button using only 1 Media Player instance?

三世轮回 提交于 2019-12-13 04:22:45
问题 I have 25 buttons in my App and 1 Media Player. What I want: When I click first time to play sound. When I click second time to stop sound But what happens: When I click first time it start playing sound, when I click again, it doesn't stop it but instead it's playing it again from beginning. My code: MediaPlayer mp; if(mp!=null) { mp.release(); mp=null; } mp = MediaPlayer.create(MainActivity.this, R.raw.s5awesomeguitar); mp.start(); How can I set my code to play Media Player on 1st click ,

Android: Music Player gets started itself after sometime

爱⌒轻易说出口 提交于 2019-12-13 04:05:29
问题 In my app, I am using media player in service for playing a music file. It is working but eventually gets started itself after sometime, and music starts playing. I am not getting where is the problem. Below, I am posting my code: Media Player Service public class ChalisaService extends Service implements OnCompletionListener { static MediaPlayer mediaPlayer; static int playerFlag = 0; TelephonyManager tm; ActivityManager actManager; /** * 0 for stop/pause * 1 for play*/ @Override public

MPMoviePlayerController buffering state

冷暖自知 提交于 2019-12-13 03:54:20
问题 Just a very short question: How can I find out if the MPMoviePlayerController instance is buffering data (in this case audio data from a web stream)? Thanks for any kind of help and have a nice day! 回答1: You need to register an object to be notified by the MPMoviePlayerLoadStateDidChangeNotification and then access the loadState of the movie player. See the notifications section of the MPMoviePlayerController reference. 来源: https://stackoverflow.com/questions/9550813/mpmovieplayercontroller