cordova-plugin-opentok
cordova-plugin-opentok copied to clipboard
Incompatible Browser on IOS and getUserMedia error
I have an error on iOS when I tried to publish my video. I have followed each step in the Running the Application section for iOS.It s working on Safari when I tried ionic serve.But on iPhone
and I saw a couple of errors on console.
@ufuksuu Even i have the same error. Did you find any solution?
That happened to me when I tried to use the JS plugin (for web) rather than the cordova plugin's js file. The cordova plugin will put a new .js file in the www directory of your app, so you should include a line like this:
<script type="text/javascript" charset="utf-8" src="opentok.js"></script>
Note that the script tag references a javascript file that doesn't exist until the project is built for iOS.
If you want to be able to develop in the browser, you either need to put the web version there, or include the following
<script type="text/javascript" charset="utf-8" src="opentok.js"></script>
<script type="text/javascript">window.OT || document.write(`<script src="https://static.opentok.com/v2/js/opentok.min.js">\x3C/script>`)</script>
This extra script tag checks to see if window.OT
is defined. If it is, then you're running on the device and the build must have inserted the opentok.js into www and it's basically a no-op. If window.OT
is not defined, then it adds a new script tag to the document as a fallback.