media-player

Pause/Stop MediaPlayer Android at given time programmatically

那年仲夏 提交于 2019-12-09 12:56:32
问题 I researched a little bit, but couldn't find any solutions to this problem: I would like to play a MediaPlayer and pause/stop it at a given time.. (ie: play from second 6 to second 17). I know that I can set its starting point with seekTo() method, but can I pause/stop it from playing by setting an end point (of course, before reaching the file end limit)? 回答1: There are different ways you could do this, here's one: int startFrom = 6000; int endAt = 11000; MediaPlayer mp; Runnable

iOS - Video not rotating only in iOS7 over iPhone?

喜欢而已 提交于 2019-12-09 08:12:21
问题 What i have Done? I am playing videos in an extended class of MPMoviePlayerViewController and have implemented orientation functions as follows - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){ return FALSE; } else{ return TRUE; } } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [self

How do I turn the system volume overlay back on after using MPVolumeView?

隐身守侯 提交于 2019-12-09 07:23:15
问题 I'm building an audio player for a non-native sound format. The application's hierarchy is based on the iPod.app. It has a number of UITableView 's and one UIView ( TrackView ) that uses an MPVolumeView to allow the user to change the volume onscreen. Until the first time TrackView becomes visible changing the volume using the hardware buttons displays the system volume overlay as expected (and desired). When TrackView is visible these overlays don't appear since the MPVolumeView updates when

Android Recyclerview MediaPlayer previous Item sound stop, release after new one is clicked

…衆ロ難τιáo~ 提交于 2019-12-09 07:04:51
问题 In my app i have recyclerview items, and each item play sound when i click it. Problem is that when i click few items, they all play sounds in the same time until they finish. Lets say i click 10 items, all 10 play sounds in the same time and after some time app get crashed and i get this error: E/MediaPlayer: error (1, -19) . I avoid app crashing by implementing automatic release with this code: mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public

Get path of song from SD card in android

前提是你 提交于 2019-12-09 07:03:32
问题 In my android application I want to fetch song from SD card but I am not able to get the path of that particular file.I am using android api level 7 which doesn't support following method. Environment.getExternalStoragePublicDirectory (Environment.DIRECTORY_MUSIC); I have also tried following code : path = Environment.getExternalStorageDirectory(); but I don't know how to specify path of music file.Please suggest some solution.Thanx. 回答1: Get path and song Name from SD Card. You can find the

Live streaming through mediaplayer in android

余生长醉 提交于 2019-12-09 06:56:56
问题 Can any body help how to stream a live url in android mediaplayer...i tried such a long but same result....plz help if any body did before 回答1: Basically, you need to do the following if you are using the Android MediaPlayer class: MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { public boolean onError(MediaPlayer mp, int what, int extra) { mp.reset(); return false; } }); mediaPlayer.setOnPreparedListener(new MediaPlayer

Dropdown contents not overlapping video player

寵の児 提交于 2019-12-09 04:50:30
I have an object tag for playing videos on my page: <object id="Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" data="mms://TAL-BBSR-01/01_Debugging.wmv" width="100%" type="video/x-ms-asf" height="400" wmode="opaque" url="mms://TAL-BBSR-01/01_Debugging.wmv"> <param name="url" value="mms://TAL-BBSR-01/01_Debugging.wmv"> <param name="filename" value="Video"> <param name="autostart" value="1"> <param name="uiMode" value="full"> <param name="autosize" value="1"> <param name="playcount" value="1"> <param name="wmode" value="opaque"> <embed height="100%" type="application/x-mplayer2"

How to determine video width and height on Android

时光毁灭记忆、已成空白 提交于 2019-12-09 04:08:35
问题 I have a video file and I want to get width and height of video. I don't want to play it, just to get size. I've tried to use MediaPlayer: MediaPlayer mp = new MediaPlayer(); mp.setDataSource(uriString); mp.prepare(); int width = mp.getVideoWidth(); int height = mp.getVideoHeight(); but it returns 0 for width and height, because VideoSizeChangedEvent didn't fire yet. How can I get width and height of video? UPD: I need API version 7 回答1: This works in API level 10 and up:

Android : how to know if MediaPlayer is paused?

百般思念 提交于 2019-12-08 14:43:38
问题 MediaPlayer.isPlaying() does not allow to know if the MediaPlayer is stopped or paused. How to know if it is paused and not stopped? Thanks ! 回答1: One way to do this is to check if the media player it not playing (paused) and check if it is at a position other than the starting position (1). MediaPlayer mediaPlayer = new MediaPlayer(); Boolean isPaused = !mediaPlayer.isPlaying() && mediaPlayer.getCurrentPosition() > 1; 回答2: There is no API to check if MediaPlayer is paused or not. So please

error -19,0 from using Mediaplayer?

穿精又带淫゛_ 提交于 2019-12-08 14:19:29
E/MediaPlayer(20473): error (-19, 0) I/MyApp (20473): Decoding lala.mp3 I/StagefrightPlayer( 68): setDataSource('mypath') E/AudioFlinger( 68): no more track names available E/AudioTrack( 68): AudioFlinger could not create track, status: -12 E/AudioSink( 68): Unable to create audio track Does any1 know why i'm getting this? This usually happens after playing about 100+ of so audio files using mediaPLayer. I'm playing it like this public RenderResultFormat DoIt() { if(mp!=null){ mp.release(); mp = null; } AudioRenderer mr = new AudioRenderer(); mp = mr.AudioRenderer(filePath);} private class