Android unable to play video from specific URL - android

I have run into a problem with playing a video from a specfic URL on Android 6.0 (sony experia mini). If I move the video to another URL I can play it. If I use a phone with Android 5.1 it works without problems.
The URL with the problem:
https://cloudadvice.blob.core.windows.net/devphotos/ff69f2ad-fd1e-48ed-9ea8-f85e65639165.mp4
Same file uploaded to dropbox (which works):
https://www.dropbox.com/s/8ftbwgavjptq9vq/ff69f2ad-fd1e-48ed-9ea8-f85e65639165%20%281%29.mp4?dl=1
I'm playing the file by writing these lines:
string videoUri = _helpRequest.VideoURL;
_videoView.SetVideoURI(Android.Net.Uri.Parse(videoUri));
I'm thinking that I've run into a bug on Android 6.0 which doesn't allow the "cloudadvice.blob.core.windows.net" in the url. Anyone tried something like this or know what might be wrong? Maybe someone got a workaround?
This is the output from the log:
06-21 11:08:46.772 D/MediaHTTPConnection(20417):
filterOutInternalHeaders: key=User-Agent, val= SonyD5803
Build/23.5.A.0.575 stagefright/1.2 (Linux;Android 6.0.1)
06-21 11:08:46.773 D/MediaHTTPConnection(20417):
filterOutInternalHeaders: key=x-wap-profile, val=
http://uaprof.sonymobile.com/D5803R2331.xml
06-21 11:08:46.774 D/MediaHTTPConnection(20417): proxy null port 0
06-21 11:08:47.113 W/MediaHTTPConnection(20417): readAt 392002 / 32768
=> java.net.ProtocolException
06-21 11:08:47.114 E/NuCachedSource2( 390): source returned error
-1010, 0 retries left 06-21 11:08:47.114 W/NuCachedSource2( 390): mFinalStatus: -1010, returning ERROR_UNSUPPORTED
06-21 11:08:47.114 E/QCExtractor( 390): ExtendedExtractor failed to
instantiate extractor
06-21 11:08:47.115 E/GenericSource( 390): Failed to init from data
source!
06-21 11:08:47.115 D/NuPlayerDriver( 390):
notifyListener_l(0xa9dc9300), (100, 1, -2147483648)
06-21 11:08:47.115 E/MediaPlayer(20417): error (1, -2147483648)
06-21 11:08:47.122 E/MediaPlayer(20417): Error (1,-2147483648)
06-21 11:08:47.122 D/VideoView(20417): Error: 1,-2147483648

Related

Audio output and Audio input flag denied by client on implementing pjsua2 voice call on Android 5.1?

I am implementing pjsua2 sample app for voice call on Android devices. It works well on android version 8, 9, 10, 11 without issue. But when I tested on Android 5.1, I can receive call from sip soft phone without any issue. But outgoing call only rings on the other side without any voice.
From the log its mentioned that both AUDIO_OUTPUT_FLAG_FAST as well as AUDIO_INPUT_FLAG_FAST denied by client. can any one suggest me how to rectify this issue.
as per below log : audio details
minFrameCount: 1857, afFrameCount=1024, minBufCount=5, sampleRate=16000, afSampleRate=44100, afLatency=115
4-12 16:17:42.320 4922-4922/org.pjsip.pjsua2 I/System.out: 16:17:42.320 pjsua_call.c !Making call with acc #0 to sip:syz#sip.xcd.com
04-12 16:17:42.321 4922-4922/org.pjsip.pjsua2 I/System.out: 16:17:42.320 pjsua_aud.c .Set sound device: capture=-1, playback=-2
04-12 16:17:42.321 4922-4922/org.pjsip.pjsua2 I/System.out: 16:17:42.321 pjsua_aud.c ..Opening sound device (speaker + mic) PCM#16000/1/20ms
04-12 16:17:42.321 4922-4922/org.pjsip.pjsua2 I/System.out: 16:17:42.321 opensl_dev.c ...Creating OpenSL stream
04-12 16:17:42.322 4922-4922/org.pjsip.pjsua2 W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client
04-12 16:17:42.322 4922-4922/org.pjsip.pjsua2 I/AudioTrack: minFrameCount: 1857, afFrameCount=1024, minBufCount=5, sampleRate=16000, afSampleRate=44100, afLatency=115
04-12 16:17:42.323 4922-4922/org.pjsip.pjsua2 W/AudioRecord: AUDIO_INPUT_FLAG_FAST denied by client
04-12 16:17:42.336 4922-4922/org.pjsip.pjsua2 I/System.out: 16:17:42.335 ec0xb8b41d98 ...Speex AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=200 ms, latency=0 ms
04-12 16:17:42.336 4922-4922/org.pjsip.pjsua2 I/System.out: 16:17:42.336 opensl_dev.c ...Starting OpenSL stream..
04-12 16:17:42.347 4922-4922/org.pjsip.pjsua2 I/System.out: 16:17:42.347 opensl_dev.c ...OpenSL stream started

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 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);

play youtube video in android

I am working on an android app and i want to play streaming video from youtube. I read posts like this: How to play YouTube video in my Android application?
I tried with that source:
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.youtube.com/watch?v=tsDYIgX_gDs")));
i got video in WebView, i can heard sound but no pictures..Also that is not what i want because i want video to start automatically when the activity start, without clicking Button play(because i want also to add some counters,timers.. for other treatments).
Then, i tried whith MediaPlayer:
String FILE_PATH="http://www.youtube.com/watch?v=tsDYIgX_gDs";
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(FILE_PATH);
mp.prepare();
mp.start();
Hopping here having a control on video start by mp.start(); . But i have these errors:
05-20 15:36:36.279: ERROR/HTTPStream(33): recv failed, errno = 11 (Try again)
05-20 15:36:36.808: ERROR/HTTPDataSource(33): HTTP request failed w/ http status 303
05-20 15:36:36.808: ERROR/HTTPDataSource(33): retrying connection failed
05-20 15:36:41.834: ERROR/HTTPStream(33): recv failed, errno = 11 (Try again)
05-20 15:36:48.389: ERROR/HTTPStream(33): recv failed, errno = 11 (Try again)
05-20 15:36:54.913: ERROR/HTTPStream(33): recv failed, errno = 11 (Try again)
05-20 15:36:54.913: ERROR/HTTPStream(33): recv failed, errno = 9 (Bad file number)
05-20 15:36:54.918: ERROR/HTTPStream(33): recv failed, errno = 9 (Bad file number)
05-20 15:36:54.918: ERROR/HTTPStream(33): recv failed, errno = 9 (Bad file number)
05-20 15:36:54.918: ERROR/MediaPlayer(6392): error (1, -2147483648)
05-20 15:36:55.219: ERROR/MediaPlayer(6392): start called in state 0
05-20 15:36:55.219: ERROR/MediaPlayer(6392): error (-38, 0)
05-20 15:36:55.228: ERROR/MediaPlayer(6392): Error (-38,0)
Can someone help plz?
Try changing the Start intent to :
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(String.format("http://www.youtube.com/v/%s",
url.substring("vnd.youtube:".length(),n)));
For deeper learning try out the following question : This, and This.

Command PLAYER_SET_DATA_SOURCE completed with an error or info PVMFErrNotSupported in android

I am using the MediaPlayer to play some .mp3 files. The files seem to
play correctly, however, every time I play one I see the following in
LogCat:
07-17 17:30:40.298: VERBOSE/SongPath(294): Songlist/data/data/com.bluepallabs.musicbank/haihai/Oopirage.mp3
07-17 17:30:40.387: WARN/MediaPlayer(294): info/warning (1, 26)
07-17 17:30:40.418: ERROR/PlayerDriver(30): Command PLAYER_SET_DATA_SOURCE completed with an error or info PVMFErrNotSupported
07-17 17:30:40.418: ERROR/MediaPlayer(294): error (1, -4)
07-17 17:30:40.427: WARN/PlayerDriver(30): PVMFInfoErrorHandlingComplete
07-17 17:30:40.518: INFO/MediaPlayer(294): Info (1,26)
07-17 17:30:40.528: ERROR/MediaPlayer(294): Error (1,-4)
As I am playing the above songpath in emulator.I am getting issue please provide any code avaible to solove this issue.
As I am using the code as:
player.reset();
songpath=/data/data/com.bluepallabs.musicbank/haihai/Oopirage.mp3
player.setDataSource(SongPath);
player.prepareAsync();
Thnak in advance.
teja
info/warning(1,26) is just a notification that error handling has started.
error(1, -4) is an Error due to the request not being supported
Try making your songpath a String then passing it into the media player like:
player.reset();
String songpath = "/data/data/com.bluepallabs.musicbank/haihai/Oopirage.mp3"
player.setDataSource(songpath);
player.prepareAsync();

Categories

Resources