Stopping the scan - android

My andrdoid app has suddenly stopped detecting the Chromecast. All other apps are picking it up.
The logs show:
12-12 23:16:24.536: D/CastMediaRouteProvider(957): in onDiscoveryRequestChanged: request=DiscoveryRequest{ selector=MediaRouteSelector{ controlCategories=[com.google.cast.CATEGORY_CAST, com.google.cast.CATEGORY_CAST_APP_NAME:b1f0fdaf-05be-4941-8918-d140393ab734_1] }, activeScan=true, isValid=true }
12-12 23:16:24.536: D/CastMediaRouteProvider(957): stopping the scan
And:
12-16 14:59:43.411: D/NetworkRequest(3276): performGet: http://10.0.0.18:8008/apps/b1f0fdaf-05be-xxxxx_1
12-16 14:59:43.411: D/SimpleHttpRequestImpl(3276): executing http request: GET http://10.0.0.18:8008/apps/b1f0fdaf-05be-xxxxx_1
12-16 14:59:43.418: D/NetworkTask(3276): onPostExecute result: -4
12-16 14:59:43.418: D/ApplicationSupportFilterListener(3276): Device does not support app b1f0fdaf-05be-xxxxx_1
12-16 14:59:43.434: D/SimpleHttpRequestImpl(3276): final URI: http://10.0.0.18:8008/apps/b1f0fdaf-05be-xxxxx_1
12-16 14:59:43.434: D/SimpleHttpRequestImpl(3276): status line: HTTP/1.1 404 Not Found
They key line is "Device does not support app [my application id]".

Related

MediaPlayer delays more than 20 seconds trying to open a non-existent url

My app uses MediaPlayer to play audio files from our CDN.
It's not the typical situation, but sometimes the file might not exist.
In that case, the CDN (AWS CloudFront-based) returns a 403 - Forbidden HTTP status code (please see attached response dump).
This seems to annoy MediaPlayer, and enters a loop of 10 delayed retries before triggering an error event. The problem is, the Java application does not have a clue on what's going on until the whole process ends.
I don't know if this is a bug in MediaPlayer, not handling the 403-Forbidden code as a fatal error, or this is done for a reason, as this happens at least in Android 5, 6 and 7, the ones I've tried.
Have you faced this problem? Is there any workaround? Should I file a bug to Android ?
in my app, this is what happens after calling prepareAsync() for a non-existent file:
04-04 06:48:16.555 327-5110/? E/NuCachedSource2: source returned error -1, 7 retries left
04-04 06:48:19.697 327-5110/? E/NuCachedSource2: source returned error -1, 6 retries left
04-04 06:48:22.779 327-5110/? E/NuCachedSource2: source returned error -1, 5 retries left
04-04 06:48:25.861 327-5110/? E/NuCachedSource2: source returned error -1, 4 retries left
04-04 06:48:28.946 327-5110/? E/NuCachedSource2: source returned error -1, 3 retries left
04-04 06:48:32.030 327-5110/? E/NuCachedSource2: source returned error -1, 2 retries left
04-04 06:48:35.101 327-5110/? E/NuCachedSource2: source returned error -1, 1 retries left
04-04 06:48:38.166 327-5110/? E/NuCachedSource2: source returned error -1, 0 retries left
note the above retries took 20 seconds, then the error is reported back to the app.
04-04 06:48:38.245 327-5105/? V/FFmpegExtractor: SniffFFMPEG
04-04 06:48:38.245 327-5105/? I/FFmpegExtractor: android-source:0xf1ae2120
04-04 06:48:38.245 327-5105/? D/FFMPEG: android source begin open
04-04 06:48:38.245 327-5105/? D/FFMPEG: android open, url: android-source:0xf1ae2120
04-04 06:48:38.245 327-5105/? D/FFMPEG: ffmpeg open android data source success, source ptr: 0xf1ae2120
04-04 06:48:38.245 327-5105/? D/FFMPEG: android source open success
04-04 06:48:38.246 327-5105/? D/FFMPEG: android source close
04-04 06:48:38.246 327-5105/? E/FFmpegExtractor: android-source:0xf1ae2120: avformat_open_input failed, err:Operation not permitted
04-04 06:48:38.246 327-5105/? W/FFmpegExtractor: sniff through BetterSniffFFMPEG failed, try LegacySniffFFMPEG
04-04 06:48:38.246 327-5105/? I/FFmpegExtractor: source url:http://????.io/juanin/story/nuit/lib/page12/audio.mp3
04-04 06:48:38.246 327-5105/? D/FFMPEG: android source begin open
04-04 06:48:38.246 327-5105/? D/FFMPEG: android open, url: android-source:0xf1ae2120|file:http://????.io/juanin/story/nuit/lib/page12/audio.mp3
04-04 06:48:38.246 327-5105/? D/FFMPEG: ffmpeg open android data source success, source ptr: 0xf1ae2120
04-04 06:48:38.246 327-5105/? D/FFMPEG: android source open success
04-04 06:48:38.246 327-5105/? D/FFMPEG: android source close
04-04 06:48:38.246 327-5105/? E/FFmpegExtractor: android-source:0xf1ae2120|file:http://????.io/juanin/story/nuit/lib/page12/audio.mp3: avformat_open_input failed, err:Operation not permitted
04-04 06:48:38.246 327-5105/? D/FFmpegExtractor: SniffFFMPEG failed to sniff this source
04-04 06:48:38.246 327-5105/? E/GenericSource: Failed to init from data source!
04-04 06:48:38.246 327-5104/? D/NuPlayerDriver: notifyListener_l(0xf1ae2060), (100, 1, -2147483648)
04-04 06:48:38.246 3199-3308/tv.nebular.app.mini E/MediaPlayer: error (1, -2147483648)
04-04 06:48:38.273 3199-3199/tv.nebular.app.mini E/MediaPlayer: Error (1,-2147483648)
And the response (403):
Accept-Ranges: bytes
Age: 1545
Cache-Control: public,max-age=30672000
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 524
Content-Type: text/html
Date: Wed, 04 Apr 2018 10:45:45 GMT
ETag: "6f8a9f263707ea54eb529ecfcd24ee65"
Last-Modified: Sat, 18 Nov 2017 17:26:22 GMT
Server: AmazonS3
Via: 1.1 xxxx.cloudfront.net (CloudFront)
X-Amz-Cf-Id: Yu-Y_bKySz9GsKwnmkdd3E7J76c8h6kAGkqpeNr9Cd2i3pjihknajg==
x-amz-meta-s3cmd-attrs: uid:501/gname:staff/xxx/gid:20/mode:33188/mtime:1511022859/atime:1511022859/md5:6f8a9f263707ea54eb529ecfcd24ee65/ctime:1511022859
X-Cache: Error from cloudfront

Android Camera API Error 100 only on back camera

I'm trying to capture an image from the back camera using the Android Camera API.
I'm using this code, 4. Tutorial: Using the camera API. It works when it uses the front camera. When I change CAMERA_FACING_FRONT to CAMERA_FACING_BACK, I get the Error 100 on
camera.takePicture(null, null, new PhotoHandler(getApplicationContext()));
I'm using Samsung Galaxy S3. Anyone knows how to solve this? It has been asked a multiple times, but I haven't found a real solution anywhere.
Edit: Full log until Error 100
No exceptions in the program itself, error log:
03-19 01:57:43.069 2348-7984/? E/DatabaseUtils﹕ Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607)
at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
at android.os.Binder.execTransact(Binder.java:388)
at dalvik.system.NativeStart.run(Native Method)
03-19 01:57:57.874 2348-2689/? E/Watchdog﹕ !#Sync 13376
03-19 01:57:59.734 18504-18557/? A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 18557 (pictureThread)
03-19 01:58:01.984 22720-22720/? E/ctxmgr﹕ [PowerConnectionProducer]Could not write powerInfo=Plug state: 2 BatteryLevel: 0.98, status=Status{statusCode=unknown status code: 7503, resolution=null}
03-19 01:58:07.239 18489-18489/com.example.luka.udpklijentandroid E/Camera﹕ Error 100
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 23.29: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 24.32: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 25.31: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 26.40: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 27.28: This output device support only one mic
03-19 01:58:07.679 18607-18607/? E/TinyUCM﹕ 28.35: This output device support only one mic
03-19 01:58:08.734 2348-2565/? E/AudioService﹕ Media server died.
03-19 01:58:08.734 2348-2565/? E/AudioService﹕ Media server started.
03-19 01:58:27.879 2348-2689/? E/Watchdog﹕ !#Sync 13377

cordova media plugin stopped working on Android 6

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?

Android TV VideoView strange error code

Im coding an player application for Android Tv.
While testing to play videos on a nexus player device the VideoView (that is a wrapper of MediaPlayer) is giving me some strange error codes that are not documented at all in the api references.
My nexus player is api 23 (android M) and i also target api 23 in my app.
Here is the log:
10-21 15:42:59.234 29145-29145/com.test.androidapp D/MediaPlayer: getMetadata
10-21 15:42:59.259 29145-29734/com.test.androidapp E/MediaPlayer: error (1, -2147479543)
10-21 15:42:59.260 29145-29262/com.test.androidapp E/MediaPlayer: error (1, -38)
10-21 15:42:59.265 29145-29145/com.test.androidapp E/MediaPlayer: Error (1,-2147479543)
10-21 15:42:59.265 29145-29145/com.test.androidapp D/VideoView: Error: 1,-2147479543

Android audio-streaming issue on version 4.2

I am building an audio streaming app. Here is the code I use to launch the media player:
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("http://wunh.org:8000/"), "audio/*");
startActivity(intent);
The code works fine on my Droid phone (Android 2.3.4) - it brings up the phone media player and plays the station...
But it does not work on Nexus 7 (Android 4.2) - both "Google play music" and "Video player" fail with the same error code:
12-04 11:49:25.373: E/MediaPlayer(13331): Error (1,-1004)
UPD: here is all related logcat entries:
12-04 14:04:21.573: D/MediaPlayer(17933): Couldn't open file on client side, trying server side
12-04 14:04:21.573: I/AwesomePlayer(128): setDataSource_l(URL suppressed)
12-04 14:04:21.583: V/ChromiumHTTPDataSource(128): connect on behalf of uid 10036
12-04 14:04:21.583: I/ChromiumHTTPDataSource(128): connect to <URL suppressed> #0
12-04 14:04:21.633: I/ActivityManager(481): Displayed com.google.android.music/.AudioPreview: +83ms
12-04 14:05:24.733: I/ChromiumHTTPDataSourceSupport(128): Request failed with status 4 and os_error -118
12-04 14:05:24.733: I/AwesomePlayer(128): mConnectingDataSource->connect() returned -1004
12-04 14:05:24.733: E/MediaPlayer(17933): error (1, -1004)
12-04 14:05:24.733: E/MediaPlayer(17933): Error (1,-1004)
Any suggestions will be greatly appreciated.
-Dmitry
AsyncPlayer? http://developer.android.com/reference/android/media/AsyncPlayer.html
AsyncPlayer ap=new AsyncPlayer("Player");
ap.play(this, Uri.parse(url), true, AudioManager.STREAM_MUSIC);

Categories

Resources