media-player

MediaPlay in Android MusicServices crashes when calling <MediaPlayer>.pause()

两盒软妹~` 提交于 2019-12-12 00:28:43
问题 In our app we have a MusicService. Currently, it works perfectly fine in terms of playing music and stopping it, but that is from starting and stopping the service. We are calling it in other methods, but mp.pause() is crashing unless it is surrounded by a null checker. But when it checks for nulls it doesn't work at all. We had all this working earlier, but we started reformatting the way were doing it, because on Android 4.0 (ICS) the Music kept playing randomly even when we stopped it, but

Should Singleton pattern be used for Android MediaPlayer

ぃ、小莉子 提交于 2019-12-11 23:06:44
问题 I am a newbie to Android and currently learning the Android SDK. I am writing a very simple application that will just play various sounds upon interacting with widgets. I am using MediaPlayer to playback the sounds. My question is should i use singleton pattern for MediaPlayer? I want just one object of MediaPlayer to be shared, but the confusion comes from the following link https://developer.android.com/reference/android/media/MediaPlayer.html which says that: It is also recommended that

Android WebKit live video streaming through asf file

非 Y 不嫁゛ 提交于 2019-12-11 20:57:58
问题 I have google around and found that Android's media player doesn't support asf. But the built in player of Google Chrome supports asf streaming. Will the WebKit's media player do that too? Can I use webkit's media player in my application to play live streaming?? 回答1: The easier solution is YourMuze FM. YourMuze FM does not provide any content. All they do is simply convert internet radio streams to formats that are suitable for mobile phones. On your desktop computer, go to Welcome to

Android Media Player

眉间皱痕 提交于 2019-12-11 16:47:26
问题 I do simple small programs in android for my practice. While I am on the way to create a simple player app, I had to face an error which I could not solve.The following is my code. import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class AndrmusiActivity extends Activity { /** Called when the activity is first created. */ public MediaPlayer playr;

How to connect Media Player to a SeekBar?

廉价感情. 提交于 2019-12-11 16:32:41
问题 I want to show the progress of a media on a seekbar. Also I want to allow user to "jump" within a medium. I have a MediaPlayer, and a SeekBar. And as far as I see there is no an easy way to merge them. 回答1: You can use VideoView instead of MediaPlayer and you can have MediaController which can be set to VideoView. Otherwise you have to get the progress at instances and update the seek bar you can use timers. 来源: https://stackoverflow.com/questions/3829679/how-to-connect-media-player-to-a

problems with onSensorChanged method

一个人想着一个人 提交于 2019-12-11 16:30:58
问题 my issue is this: i need the phone to create a MediaPlayer object called smp when: it sees that it's been shaken, it confirms that smp isn't already created, it sees that a button called hilt isChecked. when it satisfies these conditions, it should create the player, play a sound, and destroy the player. the problem i have is that it will play the sound at most twice and then force close. i'm not sure why my logic doesn't work when i've used it for buttons in the app and it causes no problems

What is this error java.lang.IllegalStateException at MediaPlayer.getCurrentPosition

时光毁灭记忆、已成空白 提交于 2019-12-11 16:19:53
问题 The error is : 05-06 22:11:15.041: E/AndroidRuntime(15780): FATAL EXCEPTION: main 05-06 22:11:15.041: E/AndroidRuntime(15780): java.lang.IllegalStateException 05-06 22:11:15.041: E/AndroidRuntime(15780): at android.media.MediaPlayer.getCurrentPosition(Native Method) 05-06 22:11:15.041: E/AndroidRuntime(15780): at android.azher.qrcodespeech.SearchActivity$2.onClick(SearchActivity.java:109) 05-06 22:11:15.041: E/AndroidRuntime(15780): at android.view.View.performClick(View.java:4204) 05-06 22

Pause MediaPlayer when using a Map in android app

早过忘川 提交于 2019-12-11 16:04:06
问题 I am building a soundboard with about 40 sounds using a map. (Previous thread) Does anyone know a good way to pause restart Mediaplayer if the app is moved to the background (incoming call or anything like that)? I'm still very new at this so it is probably something super simple. Thanks anyone who can help. Map map = new HashMap(); map.put(R.id.button1, R.raw.sound1); map.put(R.id.button2, R.raw.sound2); ... and then iterate: for (Map.Entry entry : map.entrySet()) { final MediaPlayer sound =

Play next html5 audio when one above it finishes

浪尽此生 提交于 2019-12-11 15:01:49
问题 Hello I have a series of audio clips. <div class="audio-wrapper"> <audio controls> <source src="aduio1.mp3" type="audio/mpeg"> </audio> </div> <div class="audio-wrapper"> <audio controls> <source src="aduio2.mp3" type="audio/mpeg"> </audio> </div> <div class="audio-wrapper"> <audio controls> <source src="aduio3.mp3" type="audio/mpeg"> </audio> </div> <div class="audio-wrapper"> <audio controls> <source src="aduio4.mp3" type="audio/mpeg"> </audio> </div> In my actual code the audio is spread

Streaming internet radio error android

允我心安 提交于 2019-12-11 14:28:58
问题 I am trying out to play internet radio with an example downloaded from http://www.4shared.com/zip/OTcJZZft/StreamingRadio.html which works kinda like given in this example Online radio streaming app for Android, but the problem is my logcat keeps throwing this error: 11-07 17:20:39.207: E/MediaPlayer(335): error (1, -1002) 11-07 17:20:39.237: E/MediaPlayer(335): Error (1,-1002) 11-07 17:20:48.882: W/KeyCharacterMap(335): No keyboard for id 0 11-07 17:20:48.886: W/KeyCharacterMap(335): Using