<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - webkitRequestFullscreen fulfils but will not go into fullscreen with click handler that creates MediaStream and plays video"
   href="https://bugs.webkit.org/show_bug.cgi?id=234976">234976</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>webkitRequestFullscreen fulfils but will not go into fullscreen with click handler that creates MediaStream and plays video
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Safari 15
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Layout and Rendering
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned@lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>will.morgan@iproov.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>bfulgham@webkit.org, simon.fraser@apple.com, zalan@apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=448616" name="attach_448616" title="fs.html testbed">attachment 448616</a> <a href="attachment.cgi?id=448616&action=edit" title="fs.html testbed">[details]</a></span>
fs.html testbed

When I click a button that creates a MediaStream with getUserMedia, then plays a video that satisfies the autoplay criteria, then performs webkitRequestFullscreen (WRFS), the WRFS call return but no fullscreen resize event happens.

For compatibility with other browsers, especially with regard to anti-abuse and user activation, the advice is to first getUserMedia, then play a video, then finally requestFullscreen. This is because requestFullscreen clears user activation flags, which means that you can't getUserMedia afterwards.

This is the approach suggested here: <a href="https://github.com/whatwg/fullscreen/issues/152#issuecomment-494840412">https://github.com/whatwg/fullscreen/issues/152#issuecomment-494840412</a>

My expected behaviour here would be for webkitRequestFullscreen to actually go into fullscreen, or at the very minimum if the WebKit team disagree with the WHATWG user activation approach, it should at least throw with a NotAllowedError.

This has downstream implications - sindresorhus's screenfull library returns a promise that never fulfils because WRFS doesn't throw and no change events happen. This effectively deadlocks any application that relies on entering fullscreen unless an arbitrary timeout is used.

I'm discussing the same issue with the team at Mozilla: <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=957558">https://bugzilla.mozilla.org/show_bug.cgi?id=957558</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>