opentok-react
opentok-react copied to clipboard
Failed to acquire functional stream in iOS
After iOS 13.3 we started getting having problems with our video stream solution. I'm not entirely sure if it's related to iOS 13.3 or if we just started noticing it after that update. We haven't seen the issue in any other browser.
The error occurs very sporadically, I can't tell that there's any difference between when it does happen and when it doesn't.
I get this error in the console:
[Warning] OpenTok:NativeVideoElementWrapper:3:warn Video element paused, auto-resuming. If you intended to do this, use publishVideo(false) or subscribeToVideo(false) instead. +0ms (raven.min.js, line 2)
[Error] OpenTok:Publisher:error onStreamAvailableError OT_MEDIA_ERR_ABORTED: Failed to acquire functional stream, this might be caused by the following iOS bug: https://bugs.webkit.org/show_bug.cgi?id=188088 +0ms
(anonymous function) (raven.min.js:2:1154)
(anonymous function)
s (opentok.min.js:31:30781)
(anonymous function) (opentok.min.js:24:94330)
O (opentok.min.js:24:94706)
(anonymous function) (opentok.min.js:18:2932)
k (opentok.min.js:18:2965)
N (opentok.min.js:18:2787)
I (opentok.min.js:18:2375)
p (opentok.min.js:18:697)
[Error] OpenTok:GlobalExceptionHandler:error OT.exception :: title: Unable to Publish (1500) msg: GetUserMedia +0ms
(anonymous function) (raven.min.js:2:1154)
(anonymous function)
s (opentok.min.js:31:30781)
(anonymous function) (opentok.min.js:24:6040)
(anonymous function) (opentok.min.js:24:94598)
O (opentok.min.js:24:94706)
(anonymous function) (opentok.min.js:18:2932)
k (opentok.min.js:18:2965)
N (opentok.min.js:18:2787)
I (opentok.min.js:18:2375)
p (opentok.min.js:18:697)
[Error] OpenTok:Publisher:error OT.Publisher State Change Failed: +13ms – "'Failed' cannot transition to 'MediaBound'"
(anonymous function) (raven.min.js:2:1154)
(anonymous function)
s (opentok.min.js:31:30781)
(anonymous function) (opentok.min.js:24:122276)
t (opentok.min.js:24:76924)
o (opentok.min.js:24:77100)
(anonymous function) (opentok.min.js:24:77225)
streamDestroyed (opentok.min.js:24:118418)
unpublishFromSession (opentok.min.js:24:118097)
(anonymous function) (opentok.min.js:24:274026)
value (vendor.1e00c5.js:90:624077)
value (vendor.1e00c5.js:90:623586)
r (vendor.1e00c5.js:42:62074)
o (vendor.1e00c5.js:42:62193)
a (vendor.1e00c5.js:42:62683)
commitDeletion (vendor.1e00c5.js:42:64252)
t (vendor.1e00c5.js:42:51138)
x (vendor.1e00c5.js:42:56796)
w (vendor.1e00c5.js:42:56497)
v (vendor.1e00c5.js:42:55629)
enqueueSetState (vendor.1e00c5.js:42:45471)
(anonymous function) (vendor.1e00c5.js:50:1920)
(anonymous function) (vendor.1e00c5.js:1:9470)
(anonymous function)
notify (vendor.1e00c5.js:1:5249)
(anonymous function) (vendor.1e00c5.js:1:4871)
(anonymous function)
(anonymous function) (vendor.1e00c5.js:1:9496)
(anonymous function)
notify (vendor.1e00c5.js:1:5249)
(anonymous function) (vendor.1e00c5.js:1:4871)
(anonymous function)
(anonymous function) (vendor.1e00c5.js:1:9496)
(anonymous function)
notify (vendor.1e00c5.js:1:5249)
(anonymous function) (vendor.1e00c5.js:1:4871)
(anonymous function)
(anonymous function) (vendor.1e00c5.js:1:9496)
(anonymous function)
notify (vendor.1e00c5.js:1:5249)
(anonymous function) (vendor.1e00c5.js:1:4871)
(anonymous function)
(anonymous function) (vendor.1e00c5.js:1:9496)
(anonymous function)
m (vendor.1e00c5.js:12:344668)
(anonymous function) (main.1e00c5.js:1:183905)
w (vendor.1e00c5.js:27:21001)
(anonymous function) (vendor.1e00c5.js:27:20786)
o (vendor.1e00c5.js:12:726)
initializePromise
Promise
t (vendor.1e00c5.js:12:79668)
(anonymous function) (vendor.1e00c5.js:12:674)
(anonymous function) (main.1e00c5.js:1:659287)
(anonymous function) (vendor.1e00c5.js:90:624765)
(anonymous function) (vendor.1e00c5.js:90:626317)
(anonymous function) (vendor.1e00c5.js:90:624846)
a (opentok.min.js:24:260237)
c (opentok.min.js:24:260441)
(anonymous function) (opentok.min.js:18:34570)
(anonymous function)
(anonymous function) (opentok.min.js:18:36262)
trigger (opentok.min.js:18:9806)
(anonymous function) (opentok.min.js:24:94684)
O (opentok.min.js:24:94706)
(anonymous function) (opentok.min.js:18:2932)
k (opentok.min.js:18:2965)
N (opentok.min.js:18:2787)
I (opentok.min.js:18:2375)
p (opentok.min.js:18:697)
[Error] OpenTok:Session:error
1500
+0ms – "Session.publish :: Failed to acquire functional stream, this might be caused by the following iOS bug…"
(anonymous function) (raven.min.js:2:1154)
(anonymous function)
s (opentok.min.js:31:30781)
(anonymous function) (opentok.min.js:24:273765)
(anonymous function) (opentok.min.js:18:2932)
k (opentok.min.js:18:2965)
N (opentok.min.js:18:2787)
I (opentok.min.js:18:2375)
p (opentok.min.js:18:697)
The but mentioned https://bugs.webkit.org/show_bug.cgi?id=188088 does not seem to be related. I can't find any information about the issue online, which is what makes me think it's related to iOS 13.3 that came out a week ago.
We are getting the same error. It is sporadic and only affects newer iPhones using 13.3. It just started to appear recently with no changes to our app code. This has been causing significant effects on business. If you guys can find a work around that would be great. We've tried for days to fix this to no avail.

@inlightmedia do you have any steps to repro? Or is it random?
It's pretty much random when you try to publish with getUserMedia. I've submitted a bug report to Apple as well with no response to-date. The only common and controllable factor is the device and OS. It only happens on iOS13.3 devices.
Hi, we're also facing the same issue on Safari iOS 13.3 devices. Please help us to understand when this happens, also with what steps to take to resume normal video on hitting this issue.
Has anyone made code around detecting this or even retrying the session publish?
I'm having this same issue. are there any work arounds yet?
Can you confirm it's happening with the latest opentok-react
and @opentok/client 2.17.0
?
Yes it is still happening on the latest version of opentok-react, I am just using the CDN version of opentok
<script src="https://static.opentok.com/v2/js/opentok.min.js"></script>
which is OpenTok.js 2.17.0
I figured out the reason it was happening was Iphone has a setting that rejects CORS calls even when there is 'access-control-allow-origin' * header
Disabling "Prevent Cross-Site tracking" fixes the problem. Unfortunately asking the customer to do this is a bit of a problem.
There is a beta variable "proxy" in the javascript code which looks like it might allow you to proxy the calls via your server, this would fix the problem. But there is no documentation on how to use it.
@SharePointPro I am not sure this is related Disabling "Prevent Cross-Site Tracking" fixes the problem. Unfortunately asking the customer to do this is a bit of a problem.
Why should the Get User Media function be affected by CORS? CORS is on HTTP requests.
My thinking is the error message is misleading.
I found that this error occured whenever the below error occured
XMLHttpRequest cannot load https://hlg.tokbox.com/prod/logging/ClientEvent due to access control checks.
so I chased that rabit hole, as that error wasn't happening on Andriod. The reason that errro was occuring on IPhone was becasue Iphone doesnt allow CORS even when 'access-control-allow-origin' was set to *. As soon as I disabled the feature that disallowed this call, it worked.
Perhaps throwing this error prevents it from doing some required setup?
@pstenstrm or @inlightmedia can you try disable "Prevent Cross-Site Tracking" and let us know if it makes a difference for you?
Hey @SharePointPro, if the issue is CORS, it should be something easy reproducible, do you agree? Plus, I tried to reproduce using your code and I don't see the error sorry :(
Are you able to reproduce it 100% of the time?
#105 is a dupliate, I'll delete it.
But I was wrong, its not "Prevent Cross-site tracking" that was a coincidence. I've found this error only occurs "When im on the phone while i load the page"
so to replicate it, I call the user. then i ask them to connect while im on the phone. and it doesnt work.
if they connect while im not on the phone it works...
this is only happening with IPhone but seems to be consistent now
I now think that a Iphone locks the camera when on a phone call. which is causing my issue
I beleive now that the issue is its requesting access to both Microphone AND video even though I have publishaudio:false.. since im on a call, it cant get access to microphone so failing
So there have been alot of twists and turns for me. I was looking in the wrong direction.
The problem ended up being that I was requesting both the Microphone AND the video, so when I was on the phone with the customer, it was failing because the microphone was locked.
adding audioSource: false to my <OTPublisher /> component fixed it
@SharePointPro Thank you for these details!!!! Yes, it makes sense, while you are on the phone the browser fails to get the mic access.
It seems like the issue is solved. I'll wait a bit till I get others folks feedback. 👍
FYI https://bugs.webkit.org/show_bug.cgi?id=180748#c36
I've had a hard time to reproduce this issue lately, having since updated to iOS 13.3.1. Have anyone been able to reproduce it on iOS 13.3.1?
But we're still getting reports of end users having the issue. I know when I first encountered it that I was not on the phone, nor was I using Siri.
I'm still curious if the issue can also be caused by access-control-allow-origin
, or can we rule that out? @SharePointPro You're sure that this was a coincidence?
@pstenstrm as stated before, I believe we can rule out access-control-allow-origin
. If access-control-allow-origin
were related to the issue, we would be able to reproduce it 100% of the cases. Don't you think so?
@enricop89 It could be a timing issue, but you're right, it's unlikely to be the cause of the problem.
for my particular case it was definitely a coincidence.. its also easy to test on, if you turn off "Prevent Cross-site tracking" you wont get the CORS issue.
My issue was definitely down to me requesting both the Mic and Camera, and it failing because the MIC was used by the phone call..
I ran a million tests a million different ways.
@SharePointPro And you're using iOS 13.3 and not 13.3.1?
I just checked, and was testing on 13.3.1
The error on our platform definitely happens even when the iPhone users are not on other calls. In fact, we've never reproduced (or even attempted to reproduce) the issue by having another call going on.
We have had unrelated audio issues when other apps on the iPhone steal microphone access which permanently disables audio in the session but that was unrelated to this bug.
It's now late may and I am still receiving reports of this issue. I believe this has been fixed in the official OpenTok.js version 2.17.2 - They say the following
In Safari 13.1, OT.getDevices() did not return video sources. We have fixed this issue.
Does anyone know if it's possible to update this library to include changes in 2.17.2?
We have updated to 2.17.7 but still get this error. I think it's still happening.
Any updates? Facing the same issue
Same issue on Safari iOS 13.6 devices (ipad).
@alexter42 @duataud could you provide steps to reproduce it, please?
@enricop89 I'm seeing this issue very consistently on iOS 13.3 with Safari version 13.0.4 with opentok version 2.18.1.
The steps to reproduce this are:
- Safari user connects to a Tokbox session and publishes video and audio.
- Safari user is forceDisconnected from the session by another user.
- When the Safari user tries to rejoin with the exact same parameters as in step 1, we see the errors on the 'initPublisher' SDK API call: OpenTok:Publisher:error onStreamAvailableError OT_MEDIA_ERR_ABORTED: Failed to acquire functional stream, this might be caused by the following iOS bug: https://bugs.webkit.org/show_bug.cgi?id=188088 OpenTok:Publisher:warn Received connectivity event: "Failure" without "Attempt" +0ms OpenTok:GlobalExceptionHandler:error OT.exception :: title: Unable to Publish (1500) msg: GetUserMedia +0ms
I've tested the same scenario on Android Chrome/Firefox and a different iOS version and didn't see this issue.