EricssonResearch / bowser

A WebRTC browser for iOS developed in the open
BSD 2-Clause "Simplified" License
208 stars 65 forks source link

Crashes on IPhone 5 v8.4 #80

Closed cloudis31 closed 8 years ago

cloudis31 commented 8 years ago

I've dug into the code a bit, the problem might actually be with openwebrtc, but here's the issue anyway since bowser is the app thats crashing

when i set a the src member of a video element to createObjectURL, bowser closes. it's not immediate, and from digging around i think it's somewhere in the scanVideoElements function in MediaStreamURL. It actually appeared to crash immediately, but after i put an alert after that line it still popped up. If i do not set the video src, there is no problem.

Here's the code i'm using to make this happen (this is just code i've been testing with bowser, i'm actually using a custom adapter.js that shims bowser, and works on iphone 6):

this function is called after the page has loaded, since i read that owr.js needs to finish loading and running first:

                var constraints = {
                    "audio": false,
                    "video": {facingMode: "environment"}
                };

                navigator.webkitGetUserMedia(
                    constraints, 
                    function(stream){
                        window.stream = stream;
                        var videlem = document.getElementById("cameraVideo");
                        if (window.URL) {
                            videlem.src = window.URL.createObjectURL(stream).toString();
                        } else {
                            videlem.src = stream;
                        }
                        videlem.play();
                    },
                    function(error)
                    {
                        alert(error);
                    }
                );

something i also found out was that owr.get_capture_sources only returns one video device, so you need to specify the facingMode otherwise you get the front facing camera only (and setting facingMode to environment gives you only the backfacing camera)

I know that the video element is being replaced with an img element, so wasn't sure if there is something else i needed to do to get this working on iphone 5 (the demo over at http://demo.openwebrtc.org/ crashes bowser on iphone 5 as well)

The bowser app i am using was downloaded from the app store, and i would prefer not to build it myself (i'm not really an iphone guy, but my company wants a webapp using webrtc to work on iphones as well) which is why i haven't gone in deep enough to know exactly where it is crashing.

the cameraVideo element is defined like this:

<video class="center-div" id="cameraVideo"></video>

and in javascript i set the width and height.

again all this works on iphone 6, but not iphone 5, which is on ios 8.4

I'll be happy to share any more information if there is not enough here, if anybody is interested in taking a look at this

By the way, thank you everyone for contributing and creating bowser. I've done research but still don't understand why apple decided to not yet build support for webrtc in safari. at least now i can provide a link on the page that directs iphone users to bowser in the app store.

Another thing to note is the web app is hosted on an ssl secured site, and i see that there are some calls to localhost. i'm hoping this is not a security thing, but i did host it on an http site and got the same results, so don't think thats the problem. (webrtc only works in chrome on ssl secured sites, android and desktop)

cloudis31 commented 8 years ago

Want to follow up with this. After updating to latest available ios version (9.2.1), this was no longer an issue and everything worked fine. Would be nice to know what was actually causing the browser to crash though so maybe it could be caught in js and let the user know they may need to update their os. Not a huge problem i think though, I would think most people keep their devices up to date

stefanalund commented 8 years ago

Yes, especially people who would install the relatively obscure app Bowser :smiley: If you don't mind I will close this issue.