media-player

Change media player volume on seekbar

纵饮孤独 提交于 2019-11-28 12:07:42
问题 I am working on a game application. But there is a problem on volume control. I want to change media player volume using a seekBar, and not system media volume. Is there any solution for change media player volume via seekBar. Thanks in advance. 回答1: First, get a reference from AudioManager; AudioManager audioMan = (AudioManager) getSystemService(Context.AUDIO_SERVICE); To raise the volume: audioMan.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG

“First-chance exception” meaning in MFC Appliction?

眉间皱痕 提交于 2019-11-28 11:49:41
When i run my Windows Application(MFC) i get Two Warnings. First-chance exception at 0x01046a44 in XXX.exe: 0xC0000005: Access violation reading location 0x00000048. First-chance exception at 0x75fdb9bc (KernelBase.dll) in XXX.exe: 0x000006BA: The RPC server is unavailable. May i know what they mean? Thank You What is a first chance exception? When an application is being debugged, the debugger gets notified whenever an exception is encountered. At this point, the application is suspended and the debugger decides how to handle the exception. The first pass through this mechanism is called a

Record audio on Android with MediaPlayer as source?

▼魔方 西西 提交于 2019-11-28 11:13:47
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? I don't think there is an API for that for now. Though it IS possible, you would have to have access to the device's buffer, down to the kernel/hardware level. Even if you find a way,

android:mediaplayer error(1, -17)

两盒软妹~` 提交于 2019-11-28 11:10:31
问题 I am unable to find the solution to this problem. I just have to play an audio file and get the duration of that file. Sometimes it works fine but it shows error: Below is my logcat: Please help I am stucked. 02-01 12:30:40.287: E/MediaPlayer(256): error (1, -17) 02-01 12:30:41.896: D/MediaPlayer(256): create failed: 02-01 12:30:41.896: D/MediaPlayer(256): java.io.IOException: Prepare failed.: status=0x1 02-01 12:30:41.896: D/MediaPlayer(256): at android.media.MediaPlayer.prepare(Native

How do I correctly display the position/duration of a MediaPlayer?

◇◆丶佛笑我妖孽 提交于 2019-11-28 11:10:19
Hi I want to display player position and player duration in simple date format. that is. 00:00:01/00:00:06 . The first part is current position of the player and the second part is the duration. I have used SimpleDateFormat to try display the duration and position in this format, but it is showing me the output as 05:30:00/05:30:06 . Here is the code I am using: time1 = new SimpleDateFormat("HH:mm:ss"); currentTime.setText("" + time1.format(player.getCurrentPosition()); How do I print out the position and duration correctly? (It is displaying hours/minutes that should not be there). Kindly

Media Player start stop start

前提是你 提交于 2019-11-28 10:58:56
I am making a new android sound application. I made a clickable button to play sound when I click on it. But I also want it to stop playing sound when I click for the second time. That part works fine now here is the problem, when I click again on button to play sound again, it doesn't play it, Media player is completely stopped. I was looking on forums but I can't seem to find an answer that could help me. Here is my Activity: MediaPlayer mpButtonClick1; MediaPlayer mpButtonClick2; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate

Playing an pre-recorded audio file to somebody over a call

独自空忆成欢 提交于 2019-11-28 10:53:31
问题 I understand that even though the AudioManager.STREAM_VOICE_CALL is available in the SDK for android, it is not actually been used to play a pre-recorded audio file, or atleast that is what i have heard/seen on the internet. My Question is this, if this is truly the way it is, how is prankdial accomplishing this? Many similar questions have been asked but they all seem really old, so i was wondering if anybody has gained any more insight about this. 回答1: My Question is this, if this is truly

controlling volume in MediaPlayer

六月ゝ 毕业季﹏ 提交于 2019-11-28 10:31:13
I'm playing audio (narration) in an audiobook. The audio files are in .ogg format, between 10 and 15 seconds long each. Edit to add: I'm using Android 2.2, API 8, and I have this in my Manifest: <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> I've got setVolumeControlStream(AudioManager.STREAM_MUSIC); in my onCreate() method. My sounds are being played via code similar to this: mp = MediaPlayer.create(mContext, resource); mp.setOnCompletionListener(this); mp.seekTo(0); mp.setLooping(looping); if(isSoundEnabled()) { mp.setVolume(1, 1); } else { // I still need sounds

How do I stream video and play it?

▼魔方 西西 提交于 2019-11-28 09:27:20
How can I stream video data from the network and play it on an iPhone? François P. First, are you developing a Web app optimized for iPhone or a native application ? In the first case, your only option is to transcode your video files to Quicktime H.264 (m4v or mp4 extension). You can use Quicktime Pro (use the export menu) or VLC (as a free alternative). Then simply add a hyperlink to the video file on your HTTP server. Make sure it presents the right content-type and stuff (read Safari Web Content Guide for iPhone OS: Configuring Your Server ). That'll work for web and native apps (in a

JW-Player and Rails 3.2

家住魔仙堡 提交于 2019-11-28 08:58:53
问题 I'm trying to use JW-Player in my application. Researching the issue a bit, there seems to be several abandoned efforts to produce a gem, and the latest is undocumented. So, here's how I'm going about it: I downloaded the JW-Player version 6, unzipped and copied the files in my /app/assets/javascripts directory as follows: app/assets/javascripts/jwplayer/jwplayer.js app/assets/javascripts/jwplayer.html5.js app/assets/javascripts/jwplayer.flash.swf In my app/views/layouts/application.html.erb,