Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter in-app browser failing silently #69

Open
leemartin opened this issue Jun 24, 2018 · 3 comments
Open

Twitter in-app browser failing silently #69

leemartin opened this issue Jun 24, 2018 · 3 comments

Comments

@leemartin
Copy link

This is less of an issue with this library (which works nicely) and more of an issue with Twitter's handling of their in-app iOS browser and it's WebRTC support. However, I figured someone might be able to point me in the right direction and greatly appreciate the help. I was very excited when iOS Safari added support for WebRTC and quickly made it a part of my work. However, I noticed that in-app browsers can be hit or miss when it comes to supporting standards. Last time I checked, Twitter and Instagram's in-app browsers did not support WebRTC but Facebook's did. Anyway, it's pretty straight-forward to look at the browser user agent to detect if the user is coming from an in-app browser or Safari directly. However... Twitter's in-app browser has the same exact user agent as the standalone Safari browser... FML. In addition, WebRTC seems to fail silently on prompting and I can't figure out a way to figure out if it's working or not. An easy test is to direct message yourself the following link on Twitter and attempt to open it within the iOS app:

https://www.webrtc-experiment.com/DetectRTC

The only thought I had was to use a timer to detect if either a positive or negative WebRTC action occurred after a specified period of time. If neither occurred, I could assume that something went wrong and encourage the user to try a different browser.

Any help is much appreciated.

@leemartin
Copy link
Author

Ok, here's a hacky solution which might work... it seems like when WebRTC fails in this manner, the in-app browser stops executing any code within the current function after the getUserMedia call. You can try the following Codepen which successfully alerts "before" and "after" in the iOS Safari browser but does not fire "after" in the iOS Twitter in-app browser.

https://s.codepen.io/leemartin/debug/4cb3be52f5a5c26da7b381d6a31ccbe5

So, perhaps we can set a variable of prompted originally to false and then set it to true if the "after" function gets called. Then if the prompt stays false, we would notify the user accordingly. Then again... maybe I'm just being dumb and there's a much simpler way of going about this.

@leemartin
Copy link
Author

And here's a quick example of how you can achieve this technique in Vue:

https://codepen.io/leemartin/pen/12d9440eae4d563782a3bed6e57cbc09?editors=1010

🤔

@tetreault
Copy link

WebRTC isn't implemented in a complete way outside of iOS safari. Real half-assed move by apple if you ask me. Here's a source on it https://stackoverflow.com/a/49467964. Don't bother using microphone/webcam on iOS unless you have some fallback/warning if you run it in iOS FF/iOS Chrome/social app webviews etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants