cordova-plugin-opentok icon indicating copy to clipboard operation
cordova-plugin-opentok copied to clipboard

Incompatible Browser on IOS and getUserMedia error

Open ufuksuu opened this issue 5 years ago • 2 comments

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 36440023-4883e506-1634-11e8-8d31-fbb398bca384 and I saw a couple of errors on console. Ekran Resmi 2019-06-13 10 42 48

ufuksuu avatar Jun 13 '19 12:06 ufuksuu

@ufuksuu Even i have the same error. Did you find any solution?

abhilashbr92 avatar Oct 23 '19 14:10 abhilashbr92

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.

phiferd avatar Nov 02 '19 15:11 phiferd