NEW 228860
Safari automatically reloads page when takes photos in max resolution on iPhone 7, iPhone 7 Plus.
https://bugs.webkit.org/show_bug.cgi?id=228860
Summary Safari automatically reloads page when takes photos in max resolution on iPho...
Andrew
Reported 2021-08-06 03:36:27 PDT
There is a Web RTC video stream with max resolution and video tag which shows the stream from the camera. async function setStream() { const stream = await window.navigator.mediaDevices.getUserMedia({ video: { facingMode: 'user', width: { min: 960, ideal: resolution.width, }, height: { min: 720, ideal: resolution.height, }, frameRate: { min: 30, }, aspectRatio: { ideal: RESOLUTION_ASPECT_RATIO, }, }, audio: false, }); videoNode.srcObject = stream; } It's possible to take photos by clicking on the button, this code will be run: function takePhoto() { const canvasNode = document.createElement('canvas'); canvasNode.width = videoWidth; canvasNode.height = videoHeight; const context = canvasNode.getContext('2d')!; context.drawImage(videoNode, 0, 0, videoWidth, videoHeight); const photo = canvasNode.toDataURL('image/jpeg', 1.0); } After that, will close all tracks: stream.getTracks().forEach((track) => track.stop()); Next will show the taken image. There are three the same steps, step by step in my flow. Issue: Sometimes Safari will reload the page. How I can resolve this issue?
Attachments
youenn fablet
Comment 1 2021-08-06 04:17:53 PDT
This might be a similar issue as https://bugs.webkit.org/show_bug.cgi?id=228816. Can you provide a jsfiddle that shows the issue so that I validate it is the same issue as bug 228816?
Radar WebKit Bug Importer
Comment 2 2021-08-13 03:37:15 PDT
Andrew
Comment 3 2021-08-13 05:07:05 PDT
Andrew
Comment 4 2021-08-13 05:07:50 PDT
(In reply to youenn fablet from comment #1) > This might be a similar issue as > https://bugs.webkit.org/show_bug.cgi?id=228816. > Can you provide a jsfiddle that shows the issue so that I validate it is the > same issue as bug 228816? There is an example: https://codesandbox.io/s/epic-volhard-qi9ho?file=/src/App.js
Andrew
Comment 5 2021-08-13 06:08:19 PDT
(In reply to youenn fablet from comment #1) > This might be a similar issue as > https://bugs.webkit.org/show_bug.cgi?id=228816. > Can you provide a jsfiddle that shows the issue so that I validate it is the > same issue as bug 228816? There is example without react: https://codesandbox.io/s/elated-franklin-kkjkk?file=/src/index.js
youenn fablet
Comment 6 2021-08-13 06:56:26 PDT
This does not seem to be the same issue as https://bugs.webkit.org/show_bug.cgi?id=228816. Given the page reload, it seems like the web process is jetsamed so maybe the page is taking too much memory. You can send me (youenn@apple.com) a sysdiagnose so that I validate this. Is https://jsfiddle.net/njv0sftz/ also reloading on your devices?
Andrew
Comment 7 2021-08-13 07:58:46 PDT
(In reply to youenn fablet from comment #6) > This does not seem to be the same issue as > https://bugs.webkit.org/show_bug.cgi?id=228816. > Given the page reload, it seems like the web process is jetsamed so maybe > the page is taking too much memory. > You can send me (youenn@apple.com) a sysdiagnose so that I validate this. > > Is https://jsfiddle.net/njv0sftz/ also reloading on your devices? Ok. I'm going to send you sysdiagnose. Your example has a lower quality for the camera, and it works. But, for my application, I should use the maximum quality of the camera. Maybe do you have a word of advice for me?
youenn fablet
Comment 8 2021-08-13 09:20:03 PDT
(In reply to Andrew from comment #7) > (In reply to youenn fablet from comment #6) > > This does not seem to be the same issue as > > https://bugs.webkit.org/show_bug.cgi?id=228816. > > Given the page reload, it seems like the web process is jetsamed so maybe > > the page is taking too much memory. > > You can send me (youenn@apple.com) a sysdiagnose so that I validate this. > > > > Is https://jsfiddle.net/njv0sftz/ also reloading on your devices? > > Ok. I'm going to send you sysdiagnose. > > Your example has a lower quality for the camera, and it works. But, for my > application, I should use the maximum quality of the camera. Maybe do you > have a word of advice for me? https://jsfiddle.net/qm84rgd6/1/ should get the highest size. Would it work in your devices? I'll check the sysdiagnose to validate if the process gets jetsamed or something else is going on.
Note You need to log in before you can comment on or make changes to this bug.