media-player

Playing audio file for specific time

▼魔方 西西 提交于 2020-01-05 07:02:34
问题 Guys i able to play audio file using Mediaplayer. But i need to play a audio file for specific time. Eg: play audio1.mp3 till 5 minutes. The audio file is of 10 seconds only.But it should keep playing till 5 minutes. 回答1: try this mediaplayerplayer.setLooping(true);<--- this lets the audio to loop... and this is the countdown timer MyCount counter; Long s1; counter= new MyCount(300000,1000); counter.start(); public void asdf(View v){ <---- method for onclick of buttons pause and resuming

CallBack from MediaPlayer

╄→尐↘猪︶ㄣ 提交于 2020-01-05 05:52:10
问题 I have a MediaPlayer and an audio file, which I need to play, also I have an ArrayList with the certain seconds of this audio file, on this seconds while audio is playing, I need to switch pages in the ViewPager. How to get a CallBack from the MediaPlayer in these certain moments of the time? or maybe you will recommend some other way how is possible to do it. What I have right now is the method, where I use CountDownTimer, which change pages in ViewPager, but it works wrong and it doesn't

playback audio file from byte code (audio file format is CCITT A-Law)

送分小仙女□ 提交于 2020-01-04 13:40:05
问题 I want to playback audio file from byte code. I already have byte code for audio file. But when I playback with System.Media.SoundPlayer, I got error as "{Sound API only supports playing PCM wave files."}. My audio file format is (CCITT A-Law). Can any one who have this knowledge share with me pls?? Thanks. 回答1: The standard G.711 tells you how to convert 8 bit A-law into 16 PCM. Here's a code snippet 回答2: WAV files can be encoded in many ways, usually PCM or MP3. .NET only supports PCM. Use

android mediaplayer mediacontroller timeout

Deadly 提交于 2020-01-04 02:47:05
问题 Ive implemented a mediaplayer and mediacontroller that streams a mp3 url. However my device on the TMobile network doesnt get a great 3G signal so it operates on EDGE. Im assuming that the mediaplayer is crashing because the stream is too slow or incomplete, is there a timeout I can set? 回答1: There is no timeout method in MediaPlayer, but you can implement it yourself - there are variety of ways you can do that. I suggest one of them, that I used myself and it worked for me -

How can I play a Youtube video in an iPhone

淺唱寂寞╮ 提交于 2020-01-03 20:57:08
问题 I wanted to play a Youtube video in the iPhone from within the application. I tried using the MPMoviePlayerController, but was not loading the video. It is playing the video which I loaded from the bundle but not the you tube video. I also tried to play the Youtube video by embedding it in the UIWebView, but that also was in vain. Can anybody suggest me an approach that i should take. i am testing it in the IOS 4.2 This is the code i used. mp = [[MPMoviePlayerController alloc]

How can I play a Youtube video in an iPhone

混江龙づ霸主 提交于 2020-01-03 20:57:04
问题 I wanted to play a Youtube video in the iPhone from within the application. I tried using the MPMoviePlayerController, but was not loading the video. It is playing the video which I loaded from the bundle but not the you tube video. I also tried to play the Youtube video by embedding it in the UIWebView, but that also was in vain. Can anybody suggest me an approach that i should take. i am testing it in the IOS 4.2 This is the code i used. mp = [[MPMoviePlayerController alloc]

Is it possible to create javascript audio player with multiple tracks playing in same time?

一世执手 提交于 2020-01-03 06:30:08
问题 I want to create custom player with 10 sounds for example. All 10 tracks are components of one music composition, created by different instruments. For each track I want to have on/off switcher. After clicking each switcher sounds will play. After turning on of all buttons all tracks have to be played in the same time. Each track have to be repeated again and again after finishing. Is it possible to make this without flash? This is example of this task, created in ActionScripts: http://www

Android MediaPlayer can't play web media:Prepare failed.: status=0x1

天涯浪子 提交于 2020-01-03 05:50:09
问题 I want to play a song from web service, and I wrote code as follow protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content); startButton = (ImageButton) findViewById(R.id.start); Intent intent = getIntent(); mp3Path = intent.getStringExtra("mp3Path"); player = new MediaPlayer(); startButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { if(player != null) player.stop(); player

Media Player stops abruptly with a warning in logcat: TimedEventQueue(33): Event 4 was not found in the queue, already cancelled?

纵然是瞬间 提交于 2020-01-03 03:42:26
问题 I am trying to put background music in my app.I have created an intent service which creates a Media Player and starts the music. Once my app is launched the music is played only for a second and after that I see the following warning in my logcat:- 09-13 20:12:54.082: WARN/TimedEventQueue(33): Event 4 was not found in the queue, already cancelled? For every run of my App, the Event number changes.This time it was Event 5. Here is my service class which implements media player:- import

How to use a MediaPlayer Singleton

我的梦境 提交于 2020-01-03 02:57:27
问题 I am new to Android developing and am starting with a simple soundboard application. I started developing a soundboard using multiple fragments until I realized that I was using multiple instances of MediaPlayer. This is not good because I want only one sound to play at a time. I realized that I'd have to use a MediaPlayer Singleton to solve my problem. The only problem is that I can't find many sources or examples of the MediaPlayer Singleton online. Here's what I originally put into every