Just recently update my Galaxy s5 to 5.0 from 4.4.4 and my code for my media player is broken. Everything worked fine until the update, this also occurs on my nexus 7 tablet. Im getting a url from a server and am trying to stream an mp3 from the server. This code below is all done inside of an asynctask in the onpostexecute method.
try
{
if (mediaPlayer == null)
{
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(sUrl);
mediaPlayer.setOnPreparedListener(this);
mediaPlayer.prepareAsync();
}
}
catch (IOException e)
{
e.printStackTrace();
}
#Override
public void onPrepared(MediaPlayer mp)
{
mp.start();
}
Here is my log
04-26 21:44:19.021 4660-4671/com.reach.sledgehammerlabs.reach D/MediaHTTPConnection﹕ filterOutInternalHeaders: key=User-Agent, val= Samsung SAMSUNG-SM-G900A stagefright/Beyonce/1.1.9 (Linux;Android 5.0)
04-26 21:44:19.021 4660-4725/com.reach.sledgehammerlabs.reach D/MediaHTTPConnection﹕ setReadTimeout with 30000ms
04-26 21:44:19.021 4660-4725/com.reach.sledgehammerlabs.reach I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-26 21:44:19.031 4660-4725/com.reach.sledgehammerlabs.reach I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
04-26 21:44:19.171 4660-4674/com.reach.sledgehammerlabs.reach D/MediaHTTPConnection﹕ setReadTimeout with 30000ms
04-26 21:44:19.171 4660-4674/com.reach.sledgehammerlabs.reach I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-26 21:44:19.181 4660-4674/com.reach.sledgehammerlabs.reach I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
04-26 21:44:19.351 4660-4725/com.reach.sledgehammerlabs.reach V/MediaPlayer﹕ message received msg=100, ext1=1, ext2=-2147483648
04-26 21:44:19.351 4660-4725/com.reach.sledgehammerlabs.reach E/MediaPlayer﹕ error (1, -2147483648)
04-26 21:44:19.351 4660-4725/com.reach.sledgehammerlabs.reach V/MediaPlayer﹕ callback application
04-26 21:44:19.351 4660-4725/com.reach.sledgehammerlabs.reach V/MediaPlayer﹕ back from callback
04-26 21:44:19.351 4660-4660/com.reach.sledgehammerlabs.reach E/MediaPlayer﹕ Error (1,-2147483648)
I have meet the same question.Try
setDataSource(context,Uri.parse(your url))
This solve my problem.
we faced same problem on Galaxy s4 with 5.0 update, after trying many solutions we finally changed protocol of url from http to rtsp (e.g. "http://some/file/url" with "rtsp://some/file/url")and it resolved the issue
The reason it wasn't always working was because some of the urls had spaces in them and they weren't handled correctly.
http://a space vs http://a%space
Related
I'm trying to play video from the URL. Everything seems fine in the first few minutes, but then it crashes and the message "Can't Play Video" occurs. My code:
videoView.setVisibility(View.VISIBLE);
videoView.setVideoPath(url);
videoView.setMediaController(mediaController);
videoView.seekTo(time);
videoView.start();
Logcat:
2020-04-03 22:02:29.572 25409-25409/com.modyf.anime_app W/InputTransport: Slow Input: 152ms so far, channel 'ClientState{7a1b727 uid 10348 pid 25409} (server)' publisher ~ publishKeyEvent: seq=1, deviceId=4, source=0x101, action=0x0, flags=0x8, keyCode=25, scanCode=114, metaState=0x0, repeatCount=0,downTime=101580658000000, eventTime=101580658000000
2020-04-03 22:03:54.751 25409-25421/com.modyf.anime_app W/MediaHTTPConnection: readAt 25214561 / 16799 => java.net.ProtocolException: unexpected end of stream
2020-04-03 22:05:11.419 25409-25421/com.modyf.anime_app W/MediaPlayerNative: info/warning (804, -1004)
2020-04-03 22:05:11.475 25409-25422/com.modyf.anime_app E/MediaPlayerNative: error (1, -1004)
2020-04-03 22:05:11.476 25409-25409/com.modyf.anime_app E/MediaPlayer: Error (1,-1004)
2020-04-03 22:05:11.476 25409-25409/com.modyf.anime_app D/VideoView: Error: 1,-1004
2020-04-03 22:05:11.604 25409-25439/com.modyf.anime_app W/Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:612>: EGL_BAD_ATTRIBUTE
2020-04-03 22:05:11.606 25409-25439/com.modyf.anime_app D/vndksupport: Loading /vendor/lib64/hw/gralloc.msm8937.so from current namespace instead of sphal namespace.
I am using Flutter Sound plugin to play music from a URL on Android. This worked without any problem on Android 8, but after updating to Android 9, the music from URL doesn't play anymore. I opened an issue for the plugin, but this seems to be some breaking change in the Android 9 itself.
Is there any change in Android 9 which would cause this?
I couldn't find anything obvious on android 9 changes.
Here is the log output:
I/MediaPlayer(26707): Need to enable context aware info
V/MediaPlayer-JNI(26707): native_setup
I/flutter (26707): error: Exception: Player already stopped.
V/MediaPlayerNative(26707): constructor
V/MediaPlayerNative(26707): setListener
V/MediaHTTPService(26707): MediaHTTPService(android.media.MediaHTTPService#b2558b2): Cookies: null
V/MediaPlayerNative(26707): setVideoSurfaceTexture
V/MediaPlayerNative(26707): prepare
V/MediaHTTPService(26707): makeHTTPConnection: CookieManager created: java.net.CookieManager#b993003
V/MediaHTTPService(26707): makeHTTPConnection(android.media.MediaHTTPService#b2558b2): cookieHandler: java.net.CookieManager#b993003 Cookies: null
D/MediaHTTPConnection(26707): setReadTimeOut = 15000ms
D/NetworkSecurityConfig(26707): Using Network Security Config from resource network_security_config debugBuild: true
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
V/MediaPlayerNative(26707): message received msg=300, ext1=0, ext2=0
V/MediaPlayerNative(26707): Received SEC_MM_PLAYER_CONTEXT_AWARE
V/MediaPlayerNative(26707): callback application
V/MediaPlayerNative(26707): back from callback
V/MediaPlayerNative(26707): message received msg=100, ext1=1, ext2=-2147483648
E/MediaPlayerNative(26707): error (1, -2147483648)
V/MediaPlayerNative(26707): signal application thread
V/MediaPlayerNative(26707): prepare complete - status=1
E/FlutterSoundPlugin(26707): startPlayer() exception
E/flutter (26707): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Exception: PlatformException(ERR_UNKNOWN, ERR_UNKNOWN, Prepare failed.: status=0x1)
E/flutter (26707): #0 FlutterSound.startPlayer (package:flutter_sound/flutter_sound.dart:163:7)
E/flutter (26707):
Starting with Android 9.0 (API level 28), cleartext support is disabled by default.
Because of this, the MediaPlayer was not able to open the provided URL.
Options are to:
set android:usesCleartextTraffic="true" in AndroidManifest.xml
Use HTTPS
Solutions are explained here Android 8: Cleartext HTTP traffic not permitted
I have an Xperia Z3C, Android 5.1.1 and I'm trying to connect it to a Nexus 4 Android 6.0.1 via Bluetooth. Pairing them is OK, but when I try to connect them, it says 'Connected' for less than a second and automatically disconnects.
Is this a known issue? I haven't found anything about this.
Here's what logcat says:
03-14 17:25:55.308: E/bt-btif(14245): bte_scan_filt_param_cfg_evt, 1
03-14 17:25:55.308: E/bt-btif(14245): bte_scan_filt_param_cfg_evt, 1
03-14 17:25:55.990: E/bt-btm(14245): new address: xx:xx:xx:xx:xx:xx
03-14 17:25:55.990: E/bt-btm(14245): new address: xx:xx:xx:xx:xx:xx
03-14 17:25:56.712: E/bt-btm(14245): new address: xx:xx:xx:xx:xx:xx
03-14 17:25:57.464: E/bt-btif(14245): bte_scan_filt_param_cfg_evt, 1
03-14 17:25:57.814: E/bt-btm(14245): Ignoring RNR as the state is not BTM_SEC_STATE_GETTING_NAME
03-14 17:25:57.933: E/NetlinkEvent(318): Unknown ifindex 41 in RTM_DELADDR
03-14 17:25:57.963: E/dhcpcd(15974): bt-pan: interface not found or invalid
03-14 17:25:57.986: E/BluetoothPanServiceJni(14245): ## ERROR : disconnectPanNative(L224): Failed disconnect pan channel, status: 1##
03-14 17:25:58.139: E/BluetoothTetheringNetworkFactory(14245): DHCP request error:DHCP result was failed
03-14 17:26:01.382: E/bt-btm(14245): btm_sec_disconnected - Clearing Pending flag
I had the same problem while trying to scan for Bluetooth devices from my Android application. The interesting thing is that it does not throw any exception (caught or uncaught) and fails silently! The problem occurs for devices with API Level >= 23 (Android 6.0). Here is an extract of my Logcat logs :
03-30 14:07:52.099 192-211/? I/BufferQueueProducer: [org.manios.testbt/org.manios.testbt.printing.BluetoothPrinterDiscovery](this:0x7fa16de400,id:1467,api:1,p:26262,c:192) queueBuffer: fps=0.19 dur=5154.29 max=5154.29 min=5154.29
03-30 14:07:52.114 192-192/? I/SurfaceFlinger: [Built-in Screen (type:0)] fps:1.091767,dur:1831.89,max:999.66,min:832.23
03-30 14:07:52.137 774-1001/? D/InputReader: AP_PROF:AppLaunch_dispatchPtr:Up:89556864, ID:0, Index:2056797440
03-30 14:07:52.137 774-1001/? I/PerfService: PerfServiceNative_boostEnableTimeoutMsAsync:3, 100
03-30 14:07:52.138 26262-26262/org.manios.testbt D/SettingsInterface: from settings cache , name = sound_effects_enabled , value = 0
03-30 14:07:52.138 26262-26262/org.manios.testbt D/BluetoothAdapter: isEnabled
03-30 14:07:52.140 26262-26262/org.manios.testbt D/BluetoothAdapter: getName
03-30 14:07:52.141 774-1636/? D/BluetoothManagerService: checkIfCallerIsForegroundUser: valid=true callingUser=0 parentUser=-10000 foregroundUser=0
03-30 14:07:52.142 21807-21818/? D/BluetoothAdapterProperties: getName: mName = Lenovo TAB3 8
03-30 14:07:52.144 26262-666/org.manios.testbt D/BluetoothAdapter: isEnabled
03-30 14:07:52.146 26262-666/org.manios.testbt D/BluetoothAdapter: isDiscovering
03-30 14:07:52.148 26262-666/org.manios.testbt D/BluetoothAdapter: 109507751: getState(). Returning 12
03-30 14:07:52.152 21807-21817/? D/BluetoothAdapterProperties: isDiscovering: mDiscovering = false
03-30 14:07:52.156 26262-666/org.manios.testbt D/BluetoothAdapter: startDiscovery
03-30 14:07:52.158 26262-666/org.manios.testbt D/BluetoothAdapter: 109507751: getState(). Returning 12
03-30 14:07:52.160 21807-21830/? W/bt_btif: bta_dm_check_av:0
03-30 14:07:52.172 21807-21830/? E/bt_btif: bte_scan_filt_param_cfg_evt, 1
03-30 14:07:52.181 21807-21823/? I/BluetoothAdapterProperties: Callback:discoveryStateChangeCallback with state:1
03-30 14:07:52.182 774-2924/? V/ActivityManager: Broadcast: Intent { act=android.bluetooth.adapter.action.DISCOVERY_STARTED flg=0x10 } ordered=false userid=0 callerApp=ProcessRecord{c376192 21807:com.android.bluetooth/1002}
03-30 14:07:52.184 1057-1265/? V/BluetoothEventManager: Received android.bluetooth.adapter.action.DISCOVERY_STARTED
03-30 14:07:52.185 1057-1265/? D/BluetoothEventManager: scanning state change to true
03-30 14:07:52.186 21983-21983/? D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=android.bluetooth.adapter.action.DISCOVERY_STARTED flg=0x10 cmp=com.android.settings/.bluetooth.BluetoothDiscoveryReceiver }, receiver=com.android.settings.bluetooth.BluetoothDiscoveryReceiver#b02fe63
03-30 14:07:52.186 21983-21983/? V/BluetoothDiscoveryReceiver: Received: android.bluetooth.adapter.action.DISCOVERY_STARTED
03-30 14:07:52.187 21983-21983/? D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.bluetooth.adapter.action.DISCOVERY_STARTED flg=0x10 cmp=com.android.settings/.bluetooth.BluetoothDiscoveryReceiver } packageName=com.android.settings resultCode=-1 resultData=null resultExtras=null}
03-30 14:07:52.218 774-1001/? D/InputReader: AP_PROF:AppLaunch_dispatchPtr:Down:89556946, ID:0, Index:2056794048
03-30 14:07:52.219 774-1001/? I/PerfService: PerfServiceNative_boostEnableAsync:3
I found after some searching using this issue, that in API Level >= 23 (Android 6.0) we have to add the following permission to AndroidManifext.xml
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
so that scanning and other Bluetooth actions function properly.
In Android documentation it states in BluetoothAdapter.startDiscovery() that it requires BLUETOOTH_ADMIN permission with no further details. But if we take a look into BluetoothLeScanner.startScan(),it states clearly that:
Requires BLUETOOTH_ADMIN permission. An app must hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to get results.
Hope this helps!
So two things can be going on here. Either the second device that you are trying to maintain a connection with is having an issue maintaining a connection or there is an interference being caused between the two just long enough to break the connection but not long enough to terminate it completely.
I have an application on Google Play that streams music from a radio station built with the latest cordova (5.4) and I am using some of the basic plugins such as:
device plugin
crosswalk webview plugin
dialogs plugin
...
files plugin
media plugin
On Android 5.0+ the streaming works fine but recently when I upgraded my nexus on android 6.0 the streaming stopped. I updated media and file plugin to the latest versions (2.0.0 and 4.0.0 respectively), as cordova stated in their blog that these versions support the new permission checking on Android 6 but still the streaming is not working. The log gives me this:
11-24 23:53:35.347 15184-15184/com.uni.app E/chromium: [ERROR:xwalk_autofill_client.cc(170)] Not implemented reached in virtual void xwalk::XWalkAutofillClient::OnFirstUserGestureObserved()
11-24 23:53:40.395 15184-15235/com.uni.app D/MediaPlayer: setSubtitleAnchor in MediaPlayer
11-24 23:53:40.410 15184-15235/com.uni.app W/MediaPlayer: Stream has no duration and is therefore not seekable.
11-24 23:53:40.410 15184-15235/com.uni.app E/MediaPlayer: error (-2147483648, 0)
11-24 23:53:40.410 15184-15235/com.uni.app D/AudioPlayer: Send a onStatus update for the new seek
11-24 23:53:40.410 15184-15235/com.uni.app W/CordovaPlugin: Attempted to send a second callback for ID: Media951412725 Result was: {"action":"status","status":{"id":"d5334ff7-5511-ea09-b2ef-2900789941a9","msgType":3,"value":0}}
11-24 23:53:40.411 15184-15235/com.uni.app E/MediaPlayer: start called in state 0
11-24 23:53:40.411 15184-15235/com.uni.app E/MediaPlayer: error (-38, 0)
11-24 23:53:40.412 15184-15235/com.uni.app W/CordovaPlugin: Attempted to send a second callback for ID: Media951412725 Result was: {"action":"status","status":{"id":"d5334ff7-5511-ea09-b2ef-2900789941a9","msgType":1,"value":2}}
11-24 23:53:40.412 15184-15235/com.uni.app E/MediaPlayer: Attempt to call getDuration without a valid mediaplayer
11-24 23:53:40.412 15184-15235/com.uni.app E/MediaPlayer: error (-38, 0)
11-24 23:53:40.412 15184-15235/com.uni.app W/CordovaPlugin: Attempted to send a second callback for ID: Media951412725 Result was: {"action":"status","status":{"id":"d5334ff7-5511-ea09-b2ef-2900789941a9","msgType":2,"value":314586.9375}}
11-24 23:53:40.413 15184-15235/com.uni.app E/MediaPlayer: Error (-2147483648,0)
11-24 23:53:40.413 15184-15235/com.uni.app D/AudioPlayer: on completion is calling stopped
11-24 23:53:40.414 15184-15235/com.uni.app W/CordovaPlugin: Attempted to send a second callback for ID: Media951412725 Result was: {"action":"status","status":{"id":"d5334ff7-5511-ea09-b2ef-2900789941a9","msgType":1,"value":4}}
11-24 23:53:40.414 15184-15235/com.uni.app E/MediaPlayer: Error (-38,0)
11-24 23:53:40.414 15184-15235/com.uni.app D/AudioPlayer: on completion is calling stopped
11-24 23:53:40.414 15184-15235/com.uni.app E/MediaPlayer: Error (-38,0)
11-24 23:53:40.414 15184-15235/com.uni.app D/AudioPlayer: on completion is calling stopped
11-24 23:53:53.476 15184-15184/com.uni.app E/chromium: [ERROR:xwalk_autofill_client.cc(170)] Not implemented reached in virtual void xwalk::XWalkAutofillClient::OnFirstUserGestureObserved()
11-24 23:53:58.409 15184-15232/com.uni.app E/Surface: getSlotFromBufferLocked: unknown buffer: 0xaed05f70
11-24 23:53:58.419 15184-15184/com.uni.app W/ScreenOrientationListener: Removing an inexistent observer!
11-24 23:53:58.419 15184-15184/com.uni.app E/chromium: [ERROR:runtime_javascript_dialog_manager.cc(69)] Not implemented reached in virtual void xwalk::RuntimeJavaScriptDialogManager::ResetDialogState(content::WebContents*)
11-24 23:53:58.453 15184-15184/com.uni.app D/AudioPlayer: renaming /storage/emulated/0/tmprecording.3gp to /storage/emulated/0/http://IPADDRESS:PORT/;
11-24 23:53:58.454 15184-15184/com.uni.app E/AudioPlayer: FAILED renaming /storage/emulated/0/tmprecording.3gp to /storage/emulated/0/http://IPADDRESS:PORT/;
11-24 23:53:58.465 15184-15197/com.uni.app E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb3978f90
IPADDRESS:PORT is a real http://ipaddress:port URL stream which works fine.
I now it has to do with the permissions but still no luck on finding exactly what. Going on app-info and on new permissions menu I see that the app uses Microphone, Phone and Storage permissions which are all enabled. I searched a lot and couldn't be able to find something similar.
Any help is appreciated
I found the problem, just comment this line on AudioPlayer.java
public void onPrepared(MediaPlayer player) {
// Listen for playback completion
this.player.setOnCompletionListener(this);
// seek to any location received while not prepared
//this.seekToPlaying(this.seekOnPrepared);
// If start playing after prepared
if (!this.prepareOnly) {
this.player.start();
this.setState(STATE.MEDIA_RUNNING);
this.seekOnPrepared = 0; //reset only when played
} else {
this.setState(STATE.MEDIA_STARTING);
}
// Save off duration
this.duration = getDurationInSeconds();
// reset prepare only flag
this.prepareOnly = true;
// Send status notification to JavaScript
sendStatusChange(MEDIA_DURATION, null, this.duration);
}
Checked on Github in the official repo and found this
Tried on a new sample app and worked fine on my Android 6.0 device. The solution is close to what luckakashi suggested with some extra commenting.
Seems something wrong from Crosswalk, have you try if you remove the Crosswalk plugin? And is your Android 6.0 device 64-bit?
I'm using the MediaPlayer to stream MP3 files via http and it works great in the emulator, here's the heart of the code I'm using (targeting sdk version 8):
// play selected track
if(mediaplayer.isPlaying()){
mediaplayer.reset();
}
try {
mediaplayer.setDataSource(selectedTrack.url);
mediaplayer.prepare();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mediaplayer.start();
However, when I try to debug it on a device (Motorola Droid RAZR running 2.3.5), I get the error below:
03-23 08:51:02.873: E/MediaPlayer(9442): error (1, -1004)
03-23 08:51:02.873: W/System.err(9442): java.io.IOException: Prepare failed.: status=0x1
Here's the full stack trace for the run:
03-23 08:50:44.842: W/ActivityThread(9442): Application com.murfie.murfdroid is waiting for the debugger on port 8100...
03-23 08:50:44.850: I/System.out(9442): Sending WAIT chunk
03-23 08:50:44.858: I/dalvikvm(9442): Debugger is active
03-23 08:50:45.045: I/System.out(9442): Debugger has connected
03-23 08:50:45.045: I/System.out(9442): waiting for debugger to settle...
03-23 08:50:45.248: I/System.out(9442): waiting for debugger to settle...
03-23 08:50:45.451: I/System.out(9442): waiting for debugger to settle...
03-23 08:50:45.654: I/System.out(9442): waiting for debugger to settle...
03-23 08:50:45.850: I/System.out(9442): waiting for debugger to settle...
03-23 08:50:46.053: I/System.out(9442): waiting for debugger to settle...
03-23 08:50:46.256: I/System.out(9442): waiting for debugger to settle...
03-23 08:50:46.451: I/System.out(9442): debugger has settled (1490)
03-23 08:50:46.865: D/dalvikvm(9442): GC_EXTERNAL_ALLOC freed 52K, 44% free 3066K/5379K, external 2756K/2773K, paused 28ms
03-23 08:50:52.803: D/dalvikvm(9442): GC_EXTERNAL_ALLOC freed 83K, 42% free 3194K/5447K, external 3453K/3470K, paused 26ms
03-23 08:50:55.912: D/dalvikvm(9442): GC_EXTERNAL_ALLOC freed 21K, 42% free 3208K/5447K, external 4323K/4499K, paused 36ms
03-23 08:50:55.975: D/dalvikvm(9442): GC_EXTERNAL_ALLOC freed 3K, 42% free 3205K/5447K, external 5259K/5399K, paused 25ms
03-23 08:51:02.873: E/MediaPlayer(9442): error (1, -1004)
03-23 08:51:02.873: W/System.err(9442): java.io.IOException: Prepare failed.: status=0x1
03-23 08:51:02.904: W/System.err(9442): at android.media.MediaPlayer.prepare(Native Method)
03-23 08:51:02.912: W/System.err(9442): at com.murfie.murfdroid.Murfdroid.playSelectedTrack(Murfdroid.java:162)
03-23 08:51:02.912: W/System.err(9442): at com.murfie.murfdroid.Murfdroid.access$3(Murfdroid.java:151)
03-23 08:51:02.912: W/System.err(9442): at com.murfie.murfdroid.Murfdroid$4.onClick(Murfdroid.java:130)
03-23 08:51:02.920: W/System.err(9442): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:932)
03-23 08:51:02.920: W/System.err(9442): at android.widget.AdapterView.performItemClick(AdapterView.java:290)
03-23 08:51:02.928: W/System.err(9442): at android.widget.ListView.performItemClick(ListView.java:3602)
03-23 08:51:02.928: W/System.err(9442): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1838)
03-23 08:51:02.928: W/System.err(9442): at android.os.Handler.handleCallback(Handler.java:587)
03-23 08:51:02.936: W/System.err(9442): at android.os.Handler.dispatchMessage(Handler.java:92)
03-23 08:51:02.936: W/System.err(9442): at android.os.Looper.loop(Looper.java:130)
03-23 08:51:02.936: W/System.err(9442): at android.app.ActivityThread.main(ActivityThread.java:3859)
03-23 08:51:02.944: W/System.err(9442): at java.lang.reflect.Method.invokeNative(Native Method)
03-23 08:51:02.944: W/System.err(9442): at java.lang.reflect.Method.invoke(Method.java:507)
03-23 08:51:02.944: W/System.err(9442): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:840)
03-23 08:51:02.944: W/System.err(9442): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:598)
03-23 08:51:02.951: W/System.err(9442): at dalvik.system.NativeStart.main(Native Method)
03-23 08:51:02.951: E/MediaPlayer(9442): start called in state 0
03-23 08:51:02.951: E/MediaPlayer(9442): error (-38, 0)
03-23 08:51:02.975: E/MediaPlayer(9442): Error (-38,0)
I'm new to Android development so I may be missing something obvious here, but my guess is that it may be some sort of platform-specific issue based on other bits of info I've found googling around; if targeting a higher SDK version would change that, that may be a viable option but I'd prefer to make the app compatible with as many Android devices as possible.
Update -- you have "error (1, -1004)" and here's a closely related answer: Android MediaPlayer error -1004 (ERROR_IO)
Here's something that could possibly be relevant:
http://developer.android.com/reference/android/media/MediaPlayer.html#prepare()
"For files, it is OK to call prepare(), which blocks until MediaPlayer is ready for playback."
http://developer.android.com/reference/android/media/MediaPlayer.html#prepareAsync()
"For streams, you should call prepareAsync(), which returns immediately, rather than blocking until enough data has been buffered."
Ok, here's the solution I arrived at:
After reading this thread:
http://code.google.com/p/android/issues/detail?id=17553
It became obvious that what we were trying to do would never work on pre 4.x Android and that Google had no intention of fixing it. Given this, made two changes to my app to get it working:
Implemented the StreamProxy (http://code.google.com/p/npr-android-app/source/search?q=streamproxy&origq=streamproxy&btnG=Search+Trunk) approach used to make mp3 streaming compatible with pre-2.2 Android systems
Modified the API to use non-SSL URLs for media file sources
With these two changes the app now works on the Droid RAZR, Kindle Fire and any other piece of Android hardware I can come up with.