Android Marshmallow stuttering on background streaming (Buffers?) - webview

I 'm developing an application that allows you to continue receiving (like a browser) in the background Youtube video and audio through the YouTube Player API Reference for iframe Embeds in a WebView.
When you're viewing a video, and turn off the screen with the power button, everything is still fine, but when I press the home button from the application, for a few seconds is perfectly listen, but then audio begins stuttering.
I tried to implement the WebView in a service, even with a floating overlay window, and all works, but the same thing happens when I press the home button, start stuttering audio and video (because in this case you can see the video too). Later, if I return to the application, all begin to work well again. It seems that app need to stay in foreground to work properly.
I've been trying different ideas, and I've been searching google for a week, but i dont know if this have a solution, the error is in Android 6.0, Android 5.0.2 working properly.
Here is the logcat for android 5.0.2 when i press home button:
W/cr_media: calling MediaCodec.release()
W/cr_media: calling MediaCodec.release()
E/OMXMaster: A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
W/linker: libaricentomxplugin.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
E/OMXMaster: A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
E/OMXNodeInstance: OMX_GetExtensionIndex OMX.google.android.index.storeMetaDataInBuffers failed
E/ACodec: [OMX.google.vp9.decoder] storeMetaDataInBuffers failed w/ err -2147483648
E/OMXNodeInstance: getParameter(1868562439) ERROR: 0x8000101a
And the logcat for Android 6.0:
E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb8b429e0
D/AudioManager: AudioManager dispatching onAudioFocusChange(1) for android.media.AudioManager#7f0c8a8com.mzrsoftware.android.youparrot.WebViewerYoutube$3#898cfc1
W/cr_media: calling MediaCodec.release()
W/cr_media: calling MediaCodec.release()
W/OpenGLRenderer: Fail to change FontRenderer cache size, it already initialized
E/OMXMaster: A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
E/OMXMaster: Failed to get omx plugin handle
D/AudioManager: AudioManager dispatching onAudioFocusChange(-1) for android.media.AudioManager#7f0c8a8com.mzrsoftware.android.youparrot.WebViewerYoutube$3#898cfc1
E/OMXMaster: A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
E/OMXMaster: Failed to get omx plugin handle
W/OMXNodeInstance: [1:google.vp9.decoder] component does not support metadata mode; using fallback
E/ACodec: [OMX.google.vp9.decoder] storeMetaDataInBuffers failed w/ err -1010 / is-streaming 1
E/OMXNodeInstance: getParameter(1:google.vp9.decoder, ParamVideoAndroidVp8Encoder(0x6f600007)) ERROR: UnsupportedIndex(0x8000101a)
E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb8e1a248
-----(Here audio, video or both start stuttering)-----
W/OpenGLRenderer: Fail to change FontRenderer cache size, it already initialized
E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb8ed9ff0
Viewing logcat, and with what I found online, it seems to be a problem specific to Android 6.0 with buffers (buffer underrun), which may have been fixed in Android 6.0.1 , but I can not prove it.
Any solution for this?? Thanks!

I have observed similar issue with youtube embed videos on Android L (5.1.1), but in my case issue was with video only in chrome/native browser and audio was working fine. When I play youtube embedded videos on some website, video screen remains "green". After investigating, I found that issue was with incorrect sanity check on buffers in libstagefright (check https://android-review.googlesource.com/#/c/178013/). I am developing custom ROM, so fixed it in android OS code and now AV works without issue.
As a workaround, in chrome if I enable "Media Source API" from chrome://flags then it works without making change in OS.

Related

whats the current state of navigator.mediaDevices.getUserMedia for audio on IOS

I know this has been asked before but those answers are a little dated and Apple keeps changing things. I have an PWA app that runs fine on mac (safari , chrome),windows (Chrome, edge), android (chrome, edge). But does not work on ios safari or chrome
I am testing on an IPad running ios 15.4
not sure which of navigator.mediaDevices.GetUserMedia, navigator.getUserMedia, navigator.webKitGetUSerMedia... is supposed to work
do I need to be served from HTTPS?
does audioWorklet work on any IOS browser (I can work without this, but prefer to use it)
OK well I now know a lot more about this so will add my own answer. This is microphone input
AudioWorklet works on current safari on IOS but there are many oddities to be aware of
console.log from the worklet is not reported by web inspector. So I ended up writing log messages to the worklet's messageport and logging them in the code that started the worklet
many audio examples do a lot of juggling to try to locate the 'getUserMedia' function. Safari will only work if is called like this
navigator.mediaDevices.getUserMedia
If you do
getUserMedia = navigator.mediaDevices.getUserMEdia || .... || .... ;
getUserMedia(....)
Safari will throw complaining that that function must be called a child of mediaDevices
The size of the inputs array spontaneously changes after 100 or so samples for no apparent reason. Starts out with inputs[0][0] and inputs[0][1]. Ie stereo input left and right. After 100 or so samples it suddenly only has inputs[0][0], ie mono.
the reporting of exceptions in the worklet in non existant, everything just silently fails.
async await code does not try catch properly
Ie this code
async foo(){
try{
..
await xxx();
...
catch(e){
log(e);
}
}
does not catch an exception thrown by xxx

OpenTok Web SDK on iOs: session.publish reloads page

I have set up a video-call app using the Vonage Video API and Ionic. I am using the web SDK. Everything works perfectly on browser and android devices, but I have one problem on iOs devices: after creating a publisher and calling session.publish, my app reloads instantly. The callback from session.publish does not get called, the reload happens before that. All I see is a pending "ClientEvent" XHR call that never gets resolved.
Before you ask, the user has camera and microphone permissions.
I solved this by using the VP8 video codec instead of the H264 one. It's an ongoing issue in iOs 15.1.

Google Cast plugin for Unity can't stream Video clip

I'm trying to play a Video inside Unity, and stream it to Google Cast.
Google provides a plugin that enables the connection to a Cast device, and it works fine once a correct Cast App ID is given.
Recently Unity provided a component 'VideoPlayer' that enables video playback inside a mobile device. And I tried to use both of them to stream video content on the Cast device. But when I play the video, the app stops responding with a signal 'SIGABRT' at
reinterpret_cast<PInvokeFunc>(_native_GCKUnityRenderRemoteDisplay)();
I also tried to play the video using AVPro plugin but the same issue appeared.
The plugin works just fine without a video, and the last update of the plugin is Apr 2016 so I think the plugin has some issue with the Unity's latest VideoPlayer component.
Is there something I can do about it?
There are currently no plans to update the Google Cast Unity plugin.

Bug in 'YouTube iOS Player Helper' library

I have been using the 'YouTube iOS Player Helper' library for playback of our youtube videos in our iOS App (iPhone).
Today I noticed a bug in the same, whenever it tries to load a video with 'In Stream Ads' it pauses the playback of video, closes our app and then opens mobile safari app with the link to
"pubads.g.doubleclick.net" page. The page loads with a blank screen.
I repeatedly checked the app, this behaviour is consistent with all YouTube videos with 'In Stream Ads'. Also a video without any ads is working ie playing fine in the app without triggering mobile safari.
Any ideas on when this bug will be resolved?
I'm using iOS 8.1.2 (12B440) on iTouch 5th generation. I also get the same result in iPhone simulator also.
Thanks :)
A temporary solution (until this problem is fixed) is adding another condition in the method shouldStartLoadWithRequest() that is located in the file YTPlayerView.m. The condition should intercept requests made to pubads.g.doubleclick.net.
The following lines solved the problem for me:
else if ([request.URL.host isEqual: #"pubads.g.doubleclick.net"])
{
return NO;
}

BlackBerry ButtonField not found

I have a Blackberry application. This application downloads then plays a video file.
I am trying to switch to a model where the video is bundled in with the application inside the res/media/ folder.
The only chane in the application was making the input stream that gets displayed on the Player come from the file in res/media/ rather than the file stored in the media storage of the device. I did not change anything else related to any View components.
But now when I try to start the application I get an error dialog that says:
"Error starting [myAppName]: Class 'net.rim.device.api.ui.component.ButtonField' not found."
Since I did not change anything related to a ButtonField why would I be getting this error now that the video is bundled in?
By adding the video file it made it so that my project had many additional files that needed to be signed. They all get signed correctly. But when the application is launching I get messages in the console that say something like
CMM: [MyAppName] no sig from 0x33
which I did not get when the video wasn't bundled with the resources. Is this somehow related to my problems?
My application does not even get a chance to begin. I have log statements at the beginning that I never see. It fails before it even begins.
The error you are receiving indicates that your app is too large. In my experience there is a practical limit of around 5MB for an application, any more than this and you will run into these strange 'class not found' errors.
Try adding a smaller video file to see whether the problem goes away.
CMM: [MyAppName] no sig from 0x33 means that [MyAppName] has not been signed with a code signing key identified by 0x33. This key is only available to applications produced by RIM, and can be ignored by your application. Dont worry about it.we see it all the time.
I suspect you are trying to test your app in the emulator. try your app in device and see what happens.
Also i dont think its a good idea bundling a video in your app as it will increase the size of the app significantly. You can download the app on startup and save it in filesystem. There is a limit of about 15 MB for a blackberry app. check this http://supportforums.blackberry.com/t5/Testing-and-Deployment/The-maximum-size-of-a-BlackBerry-smartphone-application/ta-p/1300209
Have you changed the JDE you use in this project? Newer JDEs are not compatible with previous OS. I have encountered same problem before, some UI components are not available after I changed JDE to 4.7.

Resources