1 Reply
      Latest reply on Sep 3, 2019 7:32 AM by tlleech
      SuwasSVR Level 1 Level 1 (0 points)
        iOS 13 beta Safari Webcam doesn't work in Portrait orientation. It works in Landscape.
        Also, It completely works on iOS 12
        Here's the code

         

        <!DOCTYPE html>
        <html>
        <head>
        <meta charset="utf-8">
        <title>Display Webcam Stream</title>
        </head>
        
        <body>
        <div id="container">
        <video autoplay="true" id="videoElement" muted playsinline>
        
        </video>
        </div>
        <script>
        
        
          var video = document.querySelector("#videoElement");
        
        
          
        if (navigator.mediaDevices.getUserMedia) {
          navigator.mediaDevices.getUserMedia({ video: true })
            .then(function (stream) {
              video.srcObject = stream;
            })
            .catch(function (err0r) {
              console.log("Something went wrong!");
            });
        }
          
        </script>
        </body>
        </html>
        

         

         

        Am I missing something here?

        • Re: iOS 13 beta Safari Webcam doesn't work in Portrait orientation
          tlleech Level 1 Level 1 (0 points)

          Hi,

           

          After you called getUserMedia in portrait mode, check the resolution of the device/stream/video track; Safari reports 0 for both width and height.

          Probably this incorrect video size causes problems in the playback. However, the stream is published to the other peer (and playback is fine).

           

          Only happens if you try opening the camera in portrait mode and add the newly created stream as the src of the video object. If you call getUserMedia in landscape mode, it works but only until you keep orientation landscape. Once you changed orientation, video picture disappears.

           

          It is certainly a bug in Safari

           

          Please let me know, when you solved it.

           

          Edit:

          On 3 September, 2019 I installed 13.1 beta iOS and it works in its Safari (shows the local stream in the video tag)