media-player

How to play audio file from raw/assets folder on the native/default media player?

ⅰ亾dé卋堺 提交于 2019-11-27 15:24:40
I know i can play an mp3 file in the media player like that: Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); File file = new File(YOUR_SONG_URI); intent.setDataAndType(Uri.fromFile(file), "audio/*"); startActivity(intent); Following this link I tried to get the URI like: Uri audio = Uri.parse("android.resource://com.audio.test/"+R.raw.audio1); Log.d(TAG,"uri:"+audio.toString()); and Uri audio = Uri.parse("android.resource://com.audio.test/raw/audio"); Log.d(TAG,"uri:"+audio.toString()); Which outputs the expected result: 01-24 15:28:23.190: D/MyClass(30234):

camera app not working?

大憨熊 提交于 2019-11-27 15:20:21
I got following stack trace 04-17 12:11:56.378: D/ATRecorder(10379): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader@40528b78 04-17 12:11:56.408: D/WindowManagerImpl(10379): addView, new view, mViews[0]: com.android.internal.policy.impl.PhoneWindow$DecorView@40520738 04-17 12:11:56.428: D/WindowManagerImpl(10379): addView, new view, mViews[1]: android.widget.LinearLayout@40525d00 04-17 12:11:56.438: D/WindowManagerImpl(10379): finishRemoveViewLocked, mViews[1]: android.widget.LinearLayout@40525d00 04-17 12:11:56.718: D/TAG(10379): Error setting camera preview:

show time when song is playing in android

若如初见. 提交于 2019-11-27 15:15:27
问题 i am trying to play a song by using MediaPlayer from the given list.i want include time duration for the song from starting to ending of the song. how to add time and how to update that time from 0:00 to till the end of that song 回答1: You can use the method getCurrentPosition() which gives you the current position in milliseconds. You can also use the method getDuration() to get the full length of the song. You can use a separate thread to update the timer. 回答2: To show the playing time, I've

Android: Play mp3 file from raw resource on click of a TextView

て烟熏妆下的殇ゞ 提交于 2019-11-27 13:34:00
Hi guys I want to play a certain mp3 file when a text is clicked. For example, I clicked the word "Nicholas", the app have to play nicholas.mp3... Sorry for my messy code, I'm new to android dev: package com.example.playword; import java.io.IOException; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; //import android.os.Handler; import android.view.View; //import android.view.View.OnClickListener; //import android.widget.Button; import android.widget.TextView; public class PlayWord extends Activity { /** Called when the activity is first created. */

How to play the audio files directly from res/raw folder?

匆匆过客 提交于 2019-11-27 13:29:55
I have multiple audio files in res/raw folder. I showing ListView that contains audio files name. I want to play the corresponding audio file when user select into the ListView . I have used setDataSource(path) , but it showing error while playing. How play the audio files directly from that folder? Or Is there any other way? add this code in onItemClickListener. listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position,long id) { TextView txtView=(TextView)view.findViewById(R.id.txt_view); String fname=txtView

How to play m3u8 on Android?

别来无恙 提交于 2019-11-27 13:21:32
As i understood, Android 3.0 and above are able for play radio streaming m3u8 - http://developer.android.com/guide/appendix/media-formats.html I put this link - http://content.mobile-tv.sky.com/content/ssna/live/ssnraudio.m3u8 into MediaPlayer but in LogCat i get: 06-01 09:04:44.287: INFO/LiveSession(33): onConnect 'http://content.mobile-tv.sky.com/content/ssna/live/ssnraudio.m3u8' 06-01 09:04:44.287: INFO/NuHTTPDataSource(33): connect to content.mobile-tv.sky.com:80/content/ssna/live/ssnraudio.m3u8 @0 06-01 09:04:44.747: INFO/NuHTTPDataSource(33): connect to content.mobile-tv.sky.com:80

Playing many different videos on iphone using AVPlayer

早过忘川 提交于 2019-11-27 12:57:33
I'm working on a custom video player for iOS using AVFoundation. The idea is to be able to switch to a different video with a gesture (tap, swipe, whatever). Right now the player is working flawlessly on simulator , but when I test it on an actual device, the view goes blank after 3 or 4 swipes. I've even created playback controls for my player, when the view goes blank, these controls load correctly but do nothing. Any ideas guys? This is the initialization for the player - (id)initWithContentURL:(NSString *)aContentURL delegate:(id)aDelegate { self = [super initWithNibName:@

Playing short .wav files - Android

拈花ヽ惹草 提交于 2019-11-27 12:29:43
I would like to play sound after touching the button. MediaPlayer works fine, but I read somewhere that this library is for long .wav (like music). Is there any better way to play short .wav(2-3 sec.)? The SoundPool is the correct class for this. The below code is an example of how to use it. It is also the code I use in several apps of mine to manage the sounds. You can have as may sounds as you like (or as memory permits). public class SoundPoolPlayer { private SoundPool mShortPlayer= null; private HashMap mSounds = new HashMap(); public SoundPoolPlayer(Context pContext) { // setup Soundpool

“binary was not built with debug information ” warning meaning in mfc application?

谁说胖子不能爱 提交于 2019-11-27 12:10:03
问题 I am getting the following Warning when i run my Windows Application(MFC) in Windows 7. 'XXX.exe': Loaded 'C:\2010\Debug\bin\plugins\control\libhotkeys_plugin.dll', Binary was not built with debug information. Please Help Me out.Thank You 回答1: It seems that your binary was build in Release mode Now there are two ways which you can follow.... build the binary with "Debug" configuration change the project settings so that a Program Database file (PDB) is generated in the release mode. Now you

Using SurfaceTexture in Android

我的梦境 提交于 2019-11-27 11:59:15
问题 I want to play a video into an OpenGL texture on XOOM using Android 3.0. I have come across SurfaceTexture in the goole developer docs which has been added in API 11 http://developer.android.com/reference/android/graphics/SurfaceTexture.html The documentation talks about using GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D, I cannot find any reference to this define in the latest android-ndk-r5c, it's not defined in in the ndk and it only goes up to platform-9, so I guess I would need