Webkit WebAudio invalidStateError DOM Exception 11 when calling bufferSource.start - javascript

I have a metronome app that was working and is published to iTunes. When ios 9 came out, it broke my app. It also breaks on OSX after upgrading to 10.11.2 as well. I download Mac Chrome and the same code works fine. So it is broken in Webkit/Safari.
If I create a bufferSourceNode and then call start on the node, I receive the error 'invalidStateError DOM Exception 11'.
There are issues reported with ios and WebAudio in relating to the touchend / touchstart events. Apparently, Apple changed the API that it required the first event to be a touchend interaction. I'm not sure if this is what is breaking my code. I tried the workaround but to no avail ( WebAudio user-gesture restriction is no longer lifted by touchstart event : https://bugs.webkit.org/show_bug.cgi?id=149367).
Does anyone have any clues or workarounds as to this issue?
Thanks,
bruce

I discovered my problem was an issue in audioContextMonkeyPatch.js that I was using for iPhone.
The start() method takes 3 parameters and I was only passing 1 parameter to the method. iPhone 8 accepted that ok, however when upgrading to iPhone 9, the underlying Safari call failed because of the undefined parameter. I put a check into the shim codes and everything resolved.

Related

WebRTC Support for Safari 11 Still Broken

I've been anxiously awaiting the release of Safari 11 on OS-X and iOS 11. Now that they're finally here, I can use Safari to record audio data from the microphone -- except that the long-promised support doesn't actually work.
I'm running macOS Sierra 10.12.6 with Safari Version 11.0 (12604.1.38.1.7). The following demos all fail with errors:
https://www.webrtc-experiment.com/RecordRTC/ -- Unhandled Promise Rejection: [object DOMError]
https://www.webrtc-experiment.com/msr/audio-recorder.html -- media error -- TypeError: undefined is not a constructor (evaluating new Recorder(mediaStream))
https://webrtc.github.io/samples/src/content/peerconnection/webaudio-input/ -- Failed to get access to local media. Error: ReferenceError
I've been able to code my own demos that work in FF/Chrome/Edge but capture only "empty" audio in Safari 11 while displaying no errors.
Can anyone out there confirm this behavior? First off, I need to know if I'm alone in seeing WebRTC completely broken in Safari 11.
Next up is Safari 11 in iOS. This is much harder for me to test. It seems like all the demos above are also broken on iOS. Safari 11 on iOS Simulator in XCode doesn't even seem to support WebRTC at all whereas actual Safari 11 on iOS reports to the browser that it's supported but, like desktop, it doesn't actually work.
Does anyone know what in the world is going on? As far as I can tell, the Safari 11 that was just pushed out to iOS 11 and Sierra not only doesn't support audio recording, but MUCH worse, passes the getUserMedia feature detection code implying audio can be captured (but it never actually works).
I'm curious if upgrading to High Sierra fixes anything but I don't want to try because even if it works there, I need access to a broken state to try and come up with some way to work around the busted feature detection.
I need to get a handle on this but it's proving difficult because the only documentation online says that "Safari 11 supports the audio portions of WebRTC" which I cannot replicate anywhere on either my phone or desktop.
Any help or confirmation would be appreciated.
The webaudio-input demo fails due to the lack of an unprefixed AudioContext. Try if
window.AudioContext = window.AudioContext || window.webkitAudioContext;
fixes things
Also see this issue about some hacks required to make things work.

Cordova Geolocation Issues in iOS 8 Beta 2

This is more of an informational post: I've spent the past few days struggling with a non-functional geolocation app on the latest iOS 8 Beta.
At first I wasn't sure if it was isolated to iOS 8, or if it was an issue of device vs simulator, but after re-downloaded XCode 6 Beta 2 (my first download had a broken simulator for some reason), I confirmed that indeed, iOS 8 Beta 2 simulator did not seem to like my attempts at grabbing a geolocation.
At first the call didn't seem to work at all; then I made a change from including phonegap.js to including cordova.js and finally made some progress. The documentation is awful on this, as following guides in the official docs seems to lead one to believe they're interchangeable. I would suggest those with issues check that first.
Rather than running the navigator.geolocation.getCurrentPosition(....) callback functions as expected, it would instead hang and not do anything at all. Sometimes navigating away from the page and back to it would force the error callback, but it was very inconsistent. After setting a { timeout: 5000 } option, it seemed to keep timing out every call. There were no errors to the console, no errors in XCode, nothing. The success function just would not run, period, and neither would the error callback if I didn't explicitly timeout after X seconds. This is an error isolated to the iOS 8 Beta, so nothing of concern to most (yet), but I felt I should post this in case someone ran into it. I'll also be posting on the Apple Dev Center.
It's a known issue and is fixed here:
https://github.com/apache/cordova-plugin-geolocation/commit/4102a332b0c6b0c3513370a4c030a32e46a51e10#commitcomment-7791523
Just tested it in iOS8, it works.
Run the following command in platforms/ios folder of your phonegap project:
cordova plugin rm org.apache.cordova.geolocation
cordova plugin add https://github.com/apache/cordova-plugin-geolocation.git
For some reason it removes the CDVLocation.m from the compilation list, you need to revert that.
The entries In XXX.xcodeproj/project.pbxproj:
979B00CA27D6412CB8C6CF74 /* CDVLocation.m in Sources / = {isa = PBXBuildFile; fileRef = E3B4F7C4AF8242A09E9BF8C1 / CDVLocation.m */; };
979B00CA27D6412CB8C6CF74 /* CDVLocation.m in Sources */,
Without these 2 lines, the plugin is not available to use in the app.
If you have that file in source control just revert the deletions related to CDVLocation.m in XXX.xcodeproj/project.pbxproj.
If not try add CDVLocation.m to the Compile Sources step in the Build Phases in the project settings.

setInterval in Android Default Browser on Galaxy S4 (Android 4.2.2)

We just got hold of a Samsung Galaxy S4 for testing our mobile website (running latest Touch-Wiz Android 4.2.2 - build JDQ39).
Straight away we noticed some major issues in our site. After some investigation, I discovered that this seems to be due to window.setInterval(fn, repeatInterval) not repeating, and only calling the passed function once.
Please note, there probably isn't a problem with our usage of setInterval, as our code works on all our other devices (lots), the chrome browser on the same device, and on desktop browsers.
I've searched, but can't find any mention of this problem. It seems bizarre to me that such a major bug would not have generated more noise.
My question is: Has anyone else seen this problem? Is it the default browser on 4.2.2, or a Touch-Wiz specific problem? Did you find an elegant work-around?
I've come up with a work-around using self-perpetuating setTimeout(s) but it's a bit nasty, and I'd rather not have to do it like that.
Turns out it wasn't actually setInterval's fault at all. Weirdly enough eval.call(window, 'some js'); seems to stop all intervals from working on this particular browser. Really don't understand how. This is the only phone we've seen it on - it doesn't happen on the stock browser on the S3 (Android 4.2.1).
P.S. The only reason we're doing eval.call is to allow make banner ads which use document.write to add scripts in a one page dynamic loading app. I'd much rather it wasn't there.

Ripple Emulator doesn't fire events

I have newest Ripple Emulator installed (newest available in Chrome Store) and everything works just fine, except events. None of them fires (not only deviceready as in some other Stack Overflow question, none).
Neither manually (using Events pane) nor automatically (deviceready) fired.
When I use manual method, Ripple writes a line to the console, that it is firing an event, but nothing actually happens. My application does not react at all. I have backbutton event bind and it is not working in Ripple. And application stopped working at all, when I moved its init part to deviceready event, as it is not being fired. Of course, on target device everything is fine, so code should be correct.
What can be causing such behavior and is there any workaround for it?
EDIT: I have Ripple Emulator (Beta) 0.9.15 installed as Chrome Extension on Windows 7. All is just fine on destination device, so JS code (events handlers) should be fine.
After deeper investigation I've managed to solve this problem (at least partially -- some events are fired some are not). In my case it was a missing .js (PhoneGap source) file problem.
The key to the success was to:
Actually have PhoneGap / Cordova JS file placed in your app content and have it correctly referenced (valid path and file name) in your source files.
Have source file in correct version (2.0.0) as of writing this.
First can be especially confusing for PhoneGap Build users, which are instructed to remove source file. Reference in source file (<script type="text/javascript" src="cordova.js"></script>) should be untouched, but file, it references, should not exits. PhoneGap Build will inject this file (in proper version) during compile / build process.
This is fine for PhoneGap, but completely wrong for Ripple. If you want Ripple to be fully functional and be able to fire events (at least certain), you should leave that file in place. I found out, that this does not interfere PhoneGap at all. Apps are builded without problems, with and without that file in place.
Second is also important. I found out, that current version of Ripple is build basing on PhoneGap API 2.0.0, which is very, very old against currently available PhoneGap API 3.0.0. So, to have Ripple working nearly without glitches, you have to [browse PhoneGap repository(http://phonegap.com/install/) and grab PhoneGap 2.0.0 sources, released 20 Jul 2012 and extract cordova.js files out of it. Then place it in source folder of your webapp, add correct reference to it and try Ripple then.
At least some events should now be fired (some, like deviceready) may still fail.
Also, keep in mind, that everything, including event handlers, must be defined in a deviceready event listener code, or the whole thing will fail.
Ripple's JIRA issues, that might be related:
Support for the last version of PhoneGap,
Ripple Emulator under Windows doesn't fire events,
Ripple should check, if phonegap.js / cordova.js files really exists.
BTW: if you open up browser's console and manually fire an event you'll see a proper notice written to console by Ripple. Which means, that Ripple thinks, if fires an even on an emulated webapp, but it actually doesn't fire it.

Windows 7 Touch Events in Firefox 6 Browser

I have written a small test page that detects and displays touch events using Javascript and HTML5 touch events. I want to test whether this actually works on a Windows Touch device. Unfortunately, I actually don’t have a touch enabled device so I’m using the Input Simulator that comes bundled with Surface 2.0 SDK to try to simulate these events. It doesn’t look like touch events are being raised in the browser (Firefox 6).
I have tried this using the TUIO plug-in by Fajran and using that to simulate touch events (so I know Firefox 6 definitely consumes these). So right now, I don’t know if these events are actually raised though in Windows 7 (I mean consumed by browsers to raise events).
Firefox said that it supported W7 Touch events in Firefox 4 onwards, but I have no idea if its still supported.
I’m still new so let me know if there’s something super obvious that I’ve missed or if there’s some more info I can provide. I looked through older posts and didn't see anything similar.
This question has been answered here: http://support.mozilla.com/en-US/questions/810808
Firefox 6 for Windows 7 still uses the old "MozTouch" events, while Firefox 6 for Android uses the standard "touchstart"/"touchmove" events.
Hope this is helpful.

Categories

Resources